From 2ed5c042d36c0b5bebbb8b7b864543cfb2710477 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:15:18 +0100 Subject: [PATCH 01/26] Keep the routing ladder on the call of 2026-11-18 --- docs/decisions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/decisions.md b/docs/decisions.md index 1181ce2f..abc688c8 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -686,6 +686,8 @@ A project's rung is its model's cheapest rung, which for Opus 5.5 is its default 2026-11-15, lilleman asked for the ladder as a file that a project can replace, on a day when an outage left only Fable 5.2 answering: the rungs were a constant in `bin/model_routing/ladder.py`, so no project could leave Sonnet 5.5 and Opus 5.5 without a release. The shipped ladder is `bin/model_routing/routing-ladder.json`, a JSON list of rungs, least competent first. A project that keeps a `routing-ladder.json` in its config's folder, `~/.claude-projects//`, runs on that ladder whole, and the steps count on it as on the shipped one. Every project still runs the same routing rules and steps, so the workflow of goal 1.3 holds; the ladder joins what a project's config folder may supply, which that goal's list does not name yet. lilleman chose a file per project over one per machine, so a single project can differ. A ladder holds one model of each family, since the Agent tool launches a subagent or a review by its family's name. The project's file is lilleman's to write, as any change to the ladder is, and the loop never commits it. loop-claude reads the project's ladder as each cycle starts; `subagent-rung` and rule-hook's `reviewer-rung` read it each time they run, from the checkout they run in. A ladder file that holds a fault stops each of them, since work routed on the shipped ladder in its place could run on a model the project cannot reach. The routing figures, `judge-replay` and `review-replay` span every project, so they read the shipped ladder: a rung only a project's own ladder holds is left out of the figures' calls, and no replay qualifies it. lilleman shipped the change as 0.10.1, a patch cut from the tag v0.10.0, on the day of the outage: it adds a file format and an exit 1 to `subagent-rung`, which the technical principles' semantic versioning gives a minor, and lilleman asked for the patch "even if that breaks semver", so that the release in use could run again without taking the unreleased work on `main`. +2026-11-18, lilleman kept the ladder and the steps as they are, settling the call raised on the routing figures measured at 2026-11-18T15:04:48Z: chunks routed onto Sonnet 5.5 at high took more review rounds past each pass's first than chunks routed onto Opus 5.5 at medium. When lilleman ruled, `routing-calls-raised.md` held no line for that call, so this note cites the time the figures were measured. The figures came from 19 chunks finished since the 2026-11-17 reset. The 13 chunks started on Sonnet 5.5 at high took a mean 0.5 rounds, 0.0 unfinished verdicts and 0.0 later fixes. The 6 started on Opus 5.5 at medium took 0.5, 0.2 and 0.0. Both means round to 0.5, so the gap in rounds is under 0.1. Sonnet 5.5 did better on unfinished verdicts, and it is the cheaper rung (goal 1.4). + Valid while the index ranks these models, and while no newer model joins the catalog. ## routing: the offline classifier may decide finished, since lilleman ruled a miss rate of about 1 in 100 decided close enough to none; the judge's model keeps every other verdict kind From 2f4442ea13523e51d9106985ce21b23bff3daa47 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:15:31 +0100 Subject: [PATCH 02/26] File item 424: refuse a Touches: list touch-predictions cannot read --- todo.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 7aea3498..fb3a0516 100644 --- a/todo.md +++ b/todo.md @@ -6,7 +6,7 @@ `Bar = 0.1` -`Next ID = 424` +`Next ID = 425` ## Items @@ -27,6 +27,7 @@ | 414 | 0.12.0 | 410 | | **DM the human through the notifier when a human-task issue blocks the epic's next item, and poll until it closes.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 417 | 0.12.0 | 410 | | **Run do-epic end to end against a sandbox epic on a real Jira site with a command of its own, outside `run-tests`.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | | 421 | 0.12.0 | | | **Refuse in rule-hook a Bash or Monitor wait that has no end: a loop without a time or count cap, and a `pgrep -f` or `pkill -f` whose pattern the same command line contains.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | +| 424 | 0.12.0 | | | **Refuse a Touches: list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | | 316 | 0.12.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.0 | | 310 | 0.12.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 | 0.9 | | 422 | 0.12.0 | 401, 420 | | **Check every 5 minutes whether a tmux window of the loop looks stuck by other signs than a lingering worker, investigate it with a headless claude, and kill only the process the investigation names.** | 3 | 2 | 3 | 6 | 5 | 1.5 by 4 | 0.8 | @@ -267,6 +268,21 @@ Touches: - `bin/rule_hook/test_rule_hook.py`: `CommandBreaches` (small) - `settings.json` +### 424. Refuse a Touches: list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check. + +On 2026-11-18 six items (400, 401, 416, 420, 421 and 422) held `Touches:` lists that touch-predictions cannot read, such as ``- `bin/judge_replay/main.py` (small)`` and ``- `README.md`: loop-claude's section (small)``. chunk-preflight reads the lists first, so loop-claude silently started nothing beside item 401, and slots sat idle for over an hour; the same mistake had been fixed by hand on 2026-11-16 (commit 4b508615). Nothing checked a list when it was written. + +Both checks call `predicted` from `bin/touch_predictions/prediction.py`, so they cannot drift from the reader; its spelling stays as it is. `todo-item add` and `edit --detail` refuse such a detail, writing nothing, in main.py before the plan's backend gets it, so a plan in Jira is held to it too. `rank_todo.py --check` fails on any item in todo.md whose list it cannot read, naming the item and the reason. Moves 1.5 (delivery speed): idle chunk slots are what the mistake cost. + +Touches: + +- `bin/todo_item/main.py`: `main` (small), `edit` (small) +- `bin/todo_item/test_todo_item.py` +- `bin/plan_store/todo_md.py`: `FilePlan.check` +- `bin/test_rank_todo.py` +- `bin/rank_todo.py`: `(module)` (small) +- `rules/todo-items.md`: `` # Todo items (`todo.md`) `` (small) + ### 316. 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. Seats run as general-purpose subagents, so each starts with the skill and agent listings, about 7,500 tokens, at $9.00 per 1,000 prefix tokens over the archive measured from 2026-09-30 to 2026-11-11: about 1.3% of spend. An agent under `agents/` with Read, Grep, Glob and Bash, `omitClaudeMd: true`, and the seat's persona in its prompt drops both; a seat reads the project as a newcomer does, which is what it simulates. Keep each seat's prompt from `skills/comprehension-panel/seat-prompts.md`. Check that a scoring run's scores on one head stay within the spread two runs of today's seats show. lilleman approved on 2026-11-11. From 963c00136bd988c6ce5c6581057f860cf2864894 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:16:13 +0100 Subject: [PATCH 03/26] Re-score item 408 at L 4, I 3 after reading its code --- todo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 7aea3498..505524b5 100644 --- a/todo.md +++ b/todo.md @@ -13,7 +13,7 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| | 401 | 0.12.0 | | | **Move loop-claude's cycle, judge, interrupt, tmux and routing into a package a second entry point drives, with loop-claude's behaviour unchanged.** | 3 | 2 | 3 | 6 | 6 | 1 by 3, code health by 2 | 1.8 | -| 408 | 0.12.0 | | | **Rank an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, then by Blocked by, and re-rank Jira's backlog to match, with people's issues keeping their rank.** | 3 | 2 | 2 | 5 | 4 | 1 by 5 | 1.6 | +| 408 | 0.12.0 | | | **Rank an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, then by Blocked by, and re-rank Jira's backlog to match, with people's issues keeping their rank.** | 4 | 2 | 3 | 7 | 5 | 1 by 5 | 1.2 | | 410 | 0.12.0 | 401, 408 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | | 416 | 0.12.0 | 410 | | **Finish an epic's repo item with a bullet under its repo's `CHANGELOG.md` → `## Unreleased`, or with none where the repo's plan is in Jira.** | 1 | 1 | 1 | 1 | 2 | 1 by 5 | 2.1 | | 413 | 0.12.0 | 410 | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | From 83714f095c27abc14932c9450f008753fc4b84d6 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:17:23 +0100 Subject: [PATCH 04/26] Refuse a Touches: list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check --- bin/plan_store/todo_md.py | 13 +++++++++-- bin/rank_todo.py | 5 ++-- bin/test_rank_todo.py | 20 ++++++++++++++++ bin/todo_item/main.py | 18 +++++++++++---- bin/todo_item/test_todo_item.py | 41 +++++++++++++++++++++++++++++++++ rules/todo-items.md | 2 +- 6 files changed, 90 insertions(+), 9 deletions(-) diff --git a/bin/plan_store/todo_md.py b/bin/plan_store/todo_md.py index 63692370..7263ec1d 100644 --- a/bin/plan_store/todo_md.py +++ b/bin/plan_store/todo_md.py @@ -11,6 +11,7 @@ from plan import ranking from record_store.stores import RecordStore from text_files.file_writes import replace_file from plan_store.scoring import weighing_texts +from touch_predictions.prediction import predicted # What the reader of a missing todo.md is told. MISSING = "every project keeps a todo.md, and rank_todo.py --help shows one" @@ -84,7 +85,7 @@ class FilePlan: return ranked def check(self) -> list[str]: - """Why `rank_todo.py --check` fails on the file, empty when it passes: the file is not ranked, or an item scores under the bar.""" + """Why `rank_todo.py --check` fails on the file, empty when it passes: the file is not ranked, an item scores under the bar, or an item's `Touches:` list is one touch-predictions cannot read.""" texts = self.texts() if isinstance(texts, Failure): return [texts.reason] @@ -92,7 +93,7 @@ class FilePlan: if isinstance(ranked, Failure): return [ranked.reason] unranked = [] if ranked.text == texts[0] else [f"{self.path}: not ranked; run rank_todo.py on it"] - return unranked + [f"{self.path}: {line}" for line in ranked.under_bar] + return unranked + [f"{self.path}: {line}" for line in ranked.under_bar + unreadable_touches(texts[0])] def reported(self, ranked: ranking.Ranked) -> list[str]: """Ranking's notes and under-bar lines, each prefixed with the file's path, as a tool prints them on stderr.""" @@ -115,6 +116,14 @@ class FilePlan: return weighing if isinstance(weighing, Failure) else (plan, *weighing) +def unreadable_touches(todo: str) -> list[str]: + """Why touch-predictions cannot read each item's `Touches:` list that it cannot. Every item is read, not only the next release's: a later item moves into the next release with its detail, and the list is fixed most cheaply where it was written.""" + details = item_details(todo) + if isinstance(details, Failure): + return [details.reason] + return [f"item {id_}: {read.reason}" for id_, detail in details.items() if isinstance(read := predicted(detail), Failure)] + + def plan_of(todo: str) -> Plan | Failure: """The plan a todo.md's text holds.""" found = items(todo) diff --git a/bin/rank_todo.py b/bin/rank_todo.py index a69ee88b..c61c54b6 100755 --- a/bin/rank_todo.py +++ b/bin/rank_todo.py @@ -11,7 +11,8 @@ question rows come first, then security rows, then the rest, each group by score 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 doesn't write -anything and fails when the file is not ranked as it would be. +anything and fails when the file is not ranked as it would be, or when an item's detail holds a +`Touches:` list that touch-predictions cannot read, as `touch-predictions --help` spells it. A valid todo.md; ## Details and each item's detail are optional: @@ -87,7 +88,7 @@ Exit 1, saying why, on bad arguments, a checkout no config names or a config tha file given that is not the config's plan, a file that cannot be read or written, a todo.md, goals file or docs/decisions.md that breaks the rules above, a scoring run on docs/comprehension-history.md's newest scored commit with no Mean row ending in its overall, an item that is not exempt scoring under the bar, or --check finding the file -unranked. +unranked or a `Touches:` list it cannot read. """ import pathlib import sys diff --git a/bin/test_rank_todo.py b/bin/test_rank_todo.py index 0fd76442..db9f32d6 100644 --- a/bin/test_rank_todo.py +++ b/bin/test_rank_todo.py @@ -11,6 +11,7 @@ from project_config.test_project_config import configured from plan.test_ranking import DECISIONS, OLD_SHAPE, README, TODO from project_config.settings import DEFAULT_FLOOR from plan import goals_file, ranking +from todo_item.test_todo_item import READABLE_TOUCHES, UNREADABLE_BULLETS import rank_todo @@ -102,6 +103,25 @@ class Main(unittest.TestCase): self.assertEqual(self.run_main(str(todo)), (1, f"{todo}: {under}\n")) self.assertEqual(self.run_main("--check", str(todo)), (1, f"{todo}: {under}\n")) + def test_check_fails_on_each_item_whose_touches_list_it_cannot_read(self): + with tempfile.TemporaryDirectory() as temp: + todo = pathlib.Path(temp, "todo.md") + configured(self, pathlib.Path(temp)) + self.enterContext(contextlib.chdir(temp)) + pathlib.Path(temp, "README.md").write_text(README) + pathlib.Path(temp, "docs").mkdir() + pathlib.Path(temp, "docs", "decisions.md").write_text(DECISIONS) + for bullet in UNREADABLE_BULLETS: + with self.subTest(bullet): + # Item 1 sits in a later release than item 3: the check reads every item's list, not only the next release's. + todo.write_text(TODO.replace("Fast detail.", READABLE_TOUCHES).replace("Later detail.", f"Touches:\n\n{bullet}")) + self.assertEqual(self.run_main(str(todo))[0], 0) + code, said = self.run_main("--check", str(todo)) + self.assertEqual(code, 1) + self.assertTrue(said.startswith(f"{todo}: item 1: "), said) + self.assertIn(repr(bullet), said) + self.assertEqual(said.count("\n"), 1) + def test_says_to_reshape_an_old_shape_table_but_passes_the_check(self): with tempfile.TemporaryDirectory() as temp: todo = pathlib.Path(temp, "todo.md") diff --git a/bin/todo_item/main.py b/bin/todo_item/main.py index e392daac..28115281 100644 --- a/bin/todo_item/main.py +++ b/bin/todo_item/main.py @@ -27,7 +27,8 @@ list and show read only the plan, and print no Score: an item's place in list's add files the item under the next free ID, with the tagline in bold, and the detail it reads from stdin, if any. The detail may hold no ## or ### heading. -It prints `Filed item in .` It doesn't write anything where ranking fails or scores the item under the bar. +It prints `Filed item in .` It doesn't write anything where ranking fails or scores the item under the bar, +or where the detail holds a `Touches:` list that touch-predictions cannot read, as `touch-predictions --help` spells it. In a Jira epic, add files a Task under the epic, and is the new issue's number. The release must be one of the Jira project's Fix Versions, named as 1.2.0 or v1.2.0 there, and --exempt security also labels the issue `security`. The item scores by the config's `jira-score-formula`, and @@ -41,7 +42,8 @@ edit sets the cells whose flag is given and leaves the rest; an empty value, as empties the cell. --detail replaces the detail with the text on stdin, and --clear-detail removes it. Text on stdin without --detail, and --detail without text on stdin, are refused, so no detail is dropped or wiped by mistake. It prints `Edited item in .` It doesn't write anything where -ranking fails or scores the item under the bar. +ranking fails or scores the item under the bar, or where a new detail holds a `Touches:` list that +touch-predictions cannot read. In a Jira epic, edit changes an issue the loop filed: its summary, description and scores, the label `security` with --exempt, and its "is blocked by" links with --blocked-by: it makes a link for each blocker added and deletes the link of each blocker dropped. Each blocker must be an open child of the @@ -92,6 +94,7 @@ from plan_store.stores import store as plan_store from record_store.stores import RecordStore, store from todo_item.table import shown, table from todo_item.edits import with_bullet +from touch_predictions.prediction import predicted # Each score flag, as --l or --L, and the field it sets. LETTERS = ("L", "E", "I", "S") @@ -115,7 +118,8 @@ def main(argv: list[str], folder: pathlib.Path = pathlib.Path(), stdin: typing.T case "show": done = show(args, plan) case "add": - done = reported(plan.add(fields(args), piped(stdin)), "not filed", lambda written: f"Filed item {written.id} in {plan.label}.") + detail = piped(stdin) + done = unreadable(detail, "not filed") or reported(plan.add(fields(args), detail), "not filed", lambda written: f"Filed item {written.id} in {plan.label}.") case "edit": done = edit(args, plan, piped(stdin)) case "move": @@ -194,6 +198,12 @@ def reported(written: Written | Failure, refusal: str, done: typing.Callable[[Wr return done(written) +def unreadable(detail: str | None, refusal: str) -> Failure | None: + """A Failure opened with refusal where detail holds a `Touches:` list touch-predictions cannot read; checked here, before the plan's backend gets the detail, so a plan in Jira is held to it too. chunk-preflight reads the list first, and on such a list starts no chunk beside the item without saying why.""" + read = None if detail is None else predicted(detail) + return Failure(f"{refusal}: {read.reason}") if isinstance(read, Failure) else None + + def list_(args: argparse.Namespace, plan: PlanStore) -> str | Failure: read = plan.read() if isinstance(read, Failure): @@ -220,7 +230,7 @@ def edit(args: argparse.Namespace, plan: PlanStore, text: str) -> str | Failure: detail = text if args.detail else "" if args.clear_detail else None if not fields(args) and detail is None: return Failure("not edited: no flag names a change; todo-item --help lists them") - return reported(plan.edit(args.id, fields(args), detail, args.comment), "not edited", lambda written: f"Edited item {written.id} in {plan.label}.") + return unreadable(detail, f"not edited: item {args.id}'s detail") or reported(plan.edit(args.id, fields(args), detail, args.comment), "not edited", lambda written: f"Edited item {written.id} in {plan.label}.") def finish(args: argparse.Namespace, plan: PlanStore, changelog: RecordStore | None) -> str | Failure: diff --git a/bin/todo_item/test_todo_item.py b/bin/todo_item/test_todo_item.py index dc021dec..13dd9496 100644 --- a/bin/todo_item/test_todo_item.py +++ b/bin/todo_item/test_todo_item.py @@ -25,6 +25,16 @@ CHANGELOG = "# Changelog\n\n## Unreleased\n\n- Older news.\n\n## 0.1.0\n\n- Firs # ## Details of the ranked fixture, without the trailing ## Notes. HEADER = "| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves |\n|---|---|---|---|---|---|---|---|---|---|---|\n" DETAILS = "## Details\n\n### 3. Make it fast, `a | b`.\n\nFast detail.\n\n### 1. Ship the later thing.\n\nLater detail.\n\n" +# The bullets six items held on 2026-11-18, which touch-predictions cannot read: `(small)` after a bare path, and a part not in backticks. +UNREADABLE_BULLETS = ( + "- `bin/judge_replay/main.py` (small)", + "- `bin/do_epic/main.py` (small)", + "- `principles/technical-principles.md`: the tests bullet group, `A valuable test checks behaviour` (small)", + "- `README.md`: loop-claude's section (small)", + "- `bin/rule_hook/rules.py`: the rule table (small)", + "- `settings.json`: the PreToolUse matcher (small)", +) +READABLE_TOUCHES = "Why.\n\nTouches:\n\n- `bin/a.py`: `main`, `Plan.branch` (small)\n- `bin/run.sh`: lines 10-20\n- `docs/new.md`\n" class Terminal(io.StringIO): @@ -488,6 +498,37 @@ class Edit(TodoItem): self.assertEqual(self.todo.read_text(), before) +class UnreadableTouches(TodoItem): + """A `Touches:` list touch-predictions cannot read is refused when written, since chunk-preflight would silently start no chunk beside the item.""" + + def test_add_and_edit_refuse_each_bullet_that_stalled_the_loop_and_write_nothing(self): + for bullet in UNREADABLE_BULLETS: + for argv, refusal in ((ADD, "not filed: "), (["edit", "3", "--detail"], "not edited: item 3's detail: ")): + with self.subTest(bullet=bullet, command=argv[0]): + before = self.todo.read_text() + code, out, err = self.run_main(*argv, stdin=f"Why.\n\nTouches:\n\n- `bin/a.py`: `main`\n{bullet}\n") + self.assertEqual((code, out), (1, "")) + self.assertTrue(err.startswith(refusal), err) + self.assertIn(repr(bullet), err) + self.assertEqual(self.todo.read_text(), before) + + def test_add_and_edit_take_a_readable_list_and_a_detail_without_one(self): + for detail in (READABLE_TOUCHES, "Why, without a list.\n"): + with self.subTest(detail): + self.assertEqual(self.run_main(*ADD, stdin=detail)[0], 0) + self.assertEqual(self.run_main("edit", "3", "--detail", stdin=detail)[0], 0) + self.assertIn(detail, self.todo.read_text()) + + def test_a_plan_in_jira_gets_no_unreadable_list_either(self): + self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', f'"{JIRA_PLAN}"') + 'env-file = "~/acme.env"\n' + JIRA_SCORING) + plan = MemoryPlan({3: {"Release": "0.1.0", "Item": "**Count the runs.**", "L": "1", "E": "2", "I": "3", "S": "1"}}) + self.enterContext(unittest.mock.patch.object(main, "plan_store", return_value=plan)) + detail = f"Touches:\n\n{UNREADABLE_BULLETS[0]}\n" + self.assertEqual(self.run_main(*ADD, stdin=detail)[:2], (1, "")) + self.assertEqual(self.run_main("edit", "3", "--detail", stdin=detail)[:2], (1, "")) + self.assertEqual((list(plan.rows), plan.details), ([3], {})) + + class Move(TodoItem): def test_sets_the_items_release_and_keeps_the_rest(self): self.assertEqual(self.run_main("move", "3", "--release", "0.2.0"), (0, f"Moved item 3 to release 0.2.0 in {self.todo}.\n", "")) diff --git a/rules/todo-items.md b/rules/todo-items.md index 2ee52c30..fd8e2c8d 100644 --- a/rules/todo-items.md +++ b/rules/todo-items.md @@ -30,4 +30,4 @@ paths: - **The Exempt cell keeps an item whatever its score:** `security` for a security finding, `defect` for a 🔴 finding or an item that restores a maintain goal the project breaks today, `question` for a question only the human can answer, which ranks first in its release, `decision` for an item `docs/decisions.md` cites, `owner` for an item the human told you to keep, and, where no other reason fits, `principle` for a 🟡 finding against a file in the config's principles folder, whose item's detail names that principle. Every item `docs/decisions.md` cites carries one of these reasons. - **A maintain goal vetoes an item that breaks it,** whatever the item scores: redesign the item so it holds the goal, or drop it. - **When you remove an item that no chunk built, title the commit `Drop item : `,** or `Drop items 12, 14 and 15: ` for several. Such an item was deleted under the bar, vetoed, superseded or moot; a finished item is not one. Without the title, `score-outcomes` credits the item with the work of the chunk that removed it, where that chunk changed more than `todo.md`. -- **Predict, in the detail of each item of the next release, what the item will touch.** When you plan the next release, or file or move an item into it, give the item's detail a `Touches:` line, then one bullet per file the item will change. Each bullet names the file, then the parts of it the item will change: a function, a class or a section heading, or line ranges where the file has none of these. A path alone means the whole file. Read the code first; a prediction from the item's text alone misses. `~/.claude/bin/touch-predictions --help` shows the spelling and how a part is named; a name that holds a backtick takes a longer run of backticks with a space inside each end, as a Markdown code span does. Mark a part `(small)` where the item changes only a few lines of it. Leave out the plan and the project's records, which every chunk writes. `chunk-preflight` reads the predictions to name the items that may start chunks at once, and `touch-predictions record` keeps each beside what its chunk touched. +- **Predict, in the detail of each item of the next release, what the item will touch.** When you plan the next release, or file or move an item into it, give the item's detail a `Touches:` line, then one bullet per file the item will change. Each bullet names the file, then the parts of it the item will change: a function, a class or a section heading, or line ranges where the file has none of these. A path alone means the whole file. Read the code first; a prediction from the item's text alone misses. `~/.claude/bin/touch-predictions --help` shows the spelling and how a part is named; a name that holds a backtick takes a longer run of backticks with a space inside each end, as a Markdown code span does. Mark a part `(small)` where the item changes only a few lines of it. `(small)` follows a part, never a bare path, and a part is a name in backticks or `lines -`. BANNED: ``- `bin/a.py` (small)``, ``- `README.md`: loop-claude's section (small)``. GOOD: ``- `bin/a.py`: `main` (small)``, ``- `README.md`: `## Loop` (small)``. `todo-item add`, `todo-item edit` and `rank_todo.py --check` refuse a list touch-predictions cannot read. Leave out the plan and the project's records, which every chunk writes. `chunk-preflight` reads the predictions to name the items that may start chunks at once, and `touch-predictions record` keeps each beside what its chunk touched. From 6b20685f8c2cb57b3cfa21a5999adb78d2d2afb1 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:17:34 +0100 Subject: [PATCH 05/26] Record the reading cost --- docs/reading-cost.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index f27e666e..1c136508 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2691,3 +2691,37 @@ Read most (opens and searches): - `bin/transcript_archive/outcomes.py` 2 - `bin/judge_replay/replay.py` 1 - `bin/rung_replay/archive.py` 1 + +## Reading cost, chunk f6452ae1f4d1, finished 2026-11-18T15:04:37Z + +164779 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 5 +- `CHANGELOG.md` 2 +- `bin/claude_code/reply.py` 2 +- `bin/do_epic/backend/contract.py` 2 +- `bin/do_epic/backend/jira.py` 2 +- `bin/do_epic/backend/test_jira.py` 2 +- `docs/decisions.md` 2 +- `bin/atlassian/client.py` 1 +- `bin/do_epic/backend/fake.py` 1 +- `bin/do_epic/backend/protocol.py` 1 + +## Reading cost, chunk a1d1adafc713, finished 2026-11-18T15:13:10Z + +257245 new input tokens before the first commit. + +Read most (opens and searches): + +- `docs/decisions.md` 11 +- `bin/review_replay/test_review_replay.py` 9 +- `bin/review_replay/replay.py` 7 +- `README.md` 6 +- `bin/review_replay/change_comparison.py` 5 +- `bin/rule_hook/test_rule_hook.py` 4 +- `bin/loop_claude/cycle/run.py` 2 +- `bin/loop_claude/test_loop_claude.py` 2 +- `bin/review_replay/main.py` 2 +- `bin/rule_hook/main.py` 2 From 02d8a0a0e6adf4f15540626e9d132d6f39ee2231 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:19:51 +0100 Subject: [PATCH 06/26] Record the reading cost --- docs/reading-cost.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index f27e666e..1c136508 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2691,3 +2691,37 @@ Read most (opens and searches): - `bin/transcript_archive/outcomes.py` 2 - `bin/judge_replay/replay.py` 1 - `bin/rung_replay/archive.py` 1 + +## Reading cost, chunk f6452ae1f4d1, finished 2026-11-18T15:04:37Z + +164779 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 5 +- `CHANGELOG.md` 2 +- `bin/claude_code/reply.py` 2 +- `bin/do_epic/backend/contract.py` 2 +- `bin/do_epic/backend/jira.py` 2 +- `bin/do_epic/backend/test_jira.py` 2 +- `docs/decisions.md` 2 +- `bin/atlassian/client.py` 1 +- `bin/do_epic/backend/fake.py` 1 +- `bin/do_epic/backend/protocol.py` 1 + +## Reading cost, chunk a1d1adafc713, finished 2026-11-18T15:13:10Z + +257245 new input tokens before the first commit. + +Read most (opens and searches): + +- `docs/decisions.md` 11 +- `bin/review_replay/test_review_replay.py` 9 +- `bin/review_replay/replay.py` 7 +- `README.md` 6 +- `bin/review_replay/change_comparison.py` 5 +- `bin/rule_hook/test_rule_hook.py` 4 +- `bin/loop_claude/cycle/run.py` 2 +- `bin/loop_claude/test_loop_claude.py` 2 +- `bin/review_replay/main.py` 2 +- `bin/rule_hook/main.py` 2 From c62242b787a8b34d6acb4d2398b31590477498fd Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:20:15 +0100 Subject: [PATCH 07/26] Split item 408: item 424 reads an epic issue's scores, item 425 re-ranks Jira --- todo.md | 55 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/todo.md b/todo.md index 505524b5..f533e3c8 100644 --- a/todo.md +++ b/todo.md @@ -6,15 +6,17 @@ `Bar = 0.1` -`Next ID = 424` +`Next ID = 426` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| +| 424 | 0.12.0 | | | **Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | +| 408 | 0.12.0 | | | **Score an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, and order them by score, then by Blocked by.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | +| 425 | 0.12.0 | 408, 424 | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | | 401 | 0.12.0 | | | **Move loop-claude's cycle, judge, interrupt, tmux and routing into a package a second entry point drives, with loop-claude's behaviour unchanged.** | 3 | 2 | 3 | 6 | 6 | 1 by 3, code health by 2 | 1.8 | -| 408 | 0.12.0 | | | **Rank an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, then by Blocked by, and re-rank Jira's backlog to match, with people's issues keeping their rank.** | 4 | 2 | 3 | 7 | 5 | 1 by 5 | 1.2 | -| 410 | 0.12.0 | 401, 408 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | +| 410 | 0.12.0 | 401, 408, 425 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | | 416 | 0.12.0 | 410 | | **Finish an epic's repo item with a bullet under its repo's `CHANGELOG.md` → `## Unreleased`, or with none where the repo's plan is in Jira.** | 1 | 1 | 1 | 1 | 2 | 1 by 5 | 2.1 | | 413 | 0.12.0 | 410 | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | | 415 | 0.12.0 | 410, 413 | | **Finish an epic: run release-review passes on each repo it changed, work what they file, have the human confirm each goal, post a summary comment, and close the epic in Jira last.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | @@ -81,6 +83,42 @@ ## Details +### 424. Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends. + +Today `EpicIssue` holds none of the three, so do-epic cannot score or order an epic's items (item 408) or tell a person's issue from its own (item 425). The Jira backend reads them as `plan_store/jira_epic.py` does: the `plan-item` issue property, its `Filed by` key, and the "is blocked by" links. The contract tests in `contract.py` cover both backends. + +Touches: + +- `bin/do_epic/backend/protocol.py`: `EpicIssue` (small) +- `bin/do_epic/backend/fake.py` +- `bin/do_epic/backend/jira.py`: `FIELDS`, `JiraEpic.found` +- `bin/do_epic/backend/contract.py` +- `bin/do_epic/backend/test_jira.py` + +### 408. Score an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, and order them by score, then by Blocked by. + +Where the epic and a repo disagree, the epic wins (`docs/decisions.md` → `do-epic: drives one Jira epic …`). An item without a repo weighs only the epic's goals. Build the chain as one list for `goal_weights`, score with `ranking.item_score` and order with `blockers_first`. `plan/ranking.py` `score` is a place the seats found hard, so the combiner must not add a branch to it. + +The epic's and a repo's goal numbers collide, so a Moves cell needs a spelling for a repo's goal beside the epic's; a panel of readers picks it before it ships (`~/.claude/CLAUDE.md` → "Bench a syntax"). The scorer takes the items and each repo's goals as values; item 424 reads them from the tracker, and item 425 re-ranks Jira by the order. + +Touches: + +- `bin/plan/todo_table.py`: `parse_moves` (small) +- `bin/do_epic/ranking.py` + +### 425. Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank. + +Split from item 408 (`docs/decisions.md` → `do-epic: drives one Jira epic …`). `EpicStore` gains a rank call, in both backends and the contract tests. Lift `JiraPlan.rank_refusal` to a module function both stores call. Walk the target order: where the issue at a position isn't the target's, rank the target's just before it; the slots people's issues hold stay theirs. A rank Jira refuses stops the walk and is reported, since a wrongly ranked team backlog takes hours to restore. + +Touches: + +- `bin/plan_store/jira_epic.py`: `JiraPlan.rank_refusal` (small) +- `bin/do_epic/backend/protocol.py`: `EpicStore` (small) +- `bin/do_epic/backend/fake.py` +- `bin/do_epic/backend/jira.py` +- `bin/do_epic/backend/contract.py` +- `bin/do_epic/ranking.py` + ### 401. Move loop-claude's cycle, judge, interrupt, tmux and routing into a package a second entry point drives, with loop-claude's behaviour unchanged. do-epic runs on these, not on a copy (`docs/decisions.md` → `do-epic: drives one Jira epic …`). Move the reusable modules into `bin/agent_cycle/`: `tmux`, `judge`, `interrupt`, `verdicts`, `retry`, `spend`, `worker`, `states`, `stop`, and the parts of `routing` that take a `ProjectRung` and a `Route`. Keep `routed_item`, `loop/`, `project/`, `escalation_mark` and `chunk_items` in `loop_claude`. Decouple `cycle/run.py`'s archive and `Chunk items:` handling, and `cycle/prompts.py`'s goals-file and `todo.md` names, behind parameters. The places the comprehension seats found hard here, `routing.py` `unfinished_route` and `cycle/judge.py` `quotes_checked`, must read no harder after the move. @@ -108,17 +146,6 @@ Touches: - `bin/rung_replay/search.py` - `README.md`: `` ### Packages under `bin/` `` (small) -### 408. Rank an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, then by Blocked by, and re-rank Jira's backlog to match, with people's issues keeping their rank. - -Where the epic and a repo disagree, the epic wins (`docs/decisions.md` → `do-epic: drives one Jira epic …`). An item without a repo weighs only the epic's goals. Reuse `goal_weights` and `weight_of`, and `JiraPlan.rank_refusal` for the rank call. `plan/ranking.py` `score` is a place the seats found hard, so the combiner must not add a branch to it. - -Touches: - -- `bin/plan/ranking.py`: `weigh`, `weight_of` (small) -- `bin/plan/goals_file.py`: `goal_weights` (small) -- `bin/plan_store/jira_epic.py`: `JiraPlan.rank_refusal` (small) -- `bin/do_epic/ranking.py` - ### 410. Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in. The lock that keeps do-epic and loop-claude apart is the per-project `starting` flock, shared by both (`docs/decisions.md` → `do-epic: drives one Jira epic …`). Each chunk routes on its repo's model and ladder, a no-repo chunk on the machine setting's model. `loop/chunk_windows.py` `start_chunks` is a place the seats found hard: make it easier to read where it changes. From 2d30339d25720d787809f5d0c868e08f8acf54d0 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:21:43 +0100 Subject: [PATCH 08/26] Move the Touches: reader into plan, so plan_store's check imports no package that imports it back --- bin/loop_claude/loop/chunk_windows.py | 2 +- bin/{touch_predictions/prediction.py => plan/touches.py} | 2 ++ bin/plan_store/todo_md.py | 2 +- bin/test_rank_todo.py | 2 +- bin/todo_item/main.py | 2 +- bin/touch_predictions/beside.py | 2 +- bin/touch_predictions/diff_parts.py | 2 +- bin/touch_predictions/main.py | 2 +- bin/touch_predictions/record.py | 2 +- bin/touch_predictions/test_touch_predictions.py | 2 +- todo.md | 4 +++- 11 files changed, 14 insertions(+), 10 deletions(-) rename bin/{touch_predictions/prediction.py => plan/touches.py} (96%) diff --git a/bin/loop_claude/loop/chunk_windows.py b/bin/loop_claude/loop/chunk_windows.py index 1020aa94..0831886f 100644 --- a/bin/loop_claude/loop/chunk_windows.py +++ b/bin/loop_claude/loop/chunk_windows.py @@ -14,7 +14,7 @@ from failure import Failure from project_config.main import located from loop_claude.loop.reload import LoopRun from release_plan.next_chunk import NextChunk, NoItem, planned -from touch_predictions.prediction import overlaps, predicted, Touches +from plan.touches import overlaps, predicted, Touches from loop_state.paths import Paths from transcript_archive.project_key import project_key from release_plan.release_standing import project_plan diff --git a/bin/touch_predictions/prediction.py b/bin/plan/touches.py similarity index 96% rename from bin/touch_predictions/prediction.py rename to bin/plan/touches.py index e8577c64..8dfa9e73 100644 --- a/bin/touch_predictions/prediction.py +++ b/bin/plan/touches.py @@ -1,5 +1,7 @@ """An item's prediction of the files and parts it will touch, as its detail spells it, and where two predictions overlap. +It sits in plan, beside the items whose details it reads, so that plan_store's `rank_todo.py --check` and todo-item can refuse a list it cannot read: touch_predictions imports plan_store, so plan_store cannot import from touch_predictions. + The spelling, which the decision `todo.md: an item of the next release predicts the files and parts it will touch …` gives the reasons for: Touches: diff --git a/bin/plan_store/todo_md.py b/bin/plan_store/todo_md.py index 7263ec1d..5c750b22 100644 --- a/bin/plan_store/todo_md.py +++ b/bin/plan_store/todo_md.py @@ -7,11 +7,11 @@ from plan_store.plans import cells, Plan, Written from failure import Failure from plan.todo_table import item_details, items, NoItemsTable, renames from plan_store import markdown_edits +from plan.touches import predicted from plan import ranking from record_store.stores import RecordStore from text_files.file_writes import replace_file from plan_store.scoring import weighing_texts -from touch_predictions.prediction import predicted # What the reader of a missing todo.md is told. MISSING = "every project keeps a todo.md, and rank_todo.py --help shows one" diff --git a/bin/test_rank_todo.py b/bin/test_rank_todo.py index db9f32d6..a6460dda 100644 --- a/bin/test_rank_todo.py +++ b/bin/test_rank_todo.py @@ -11,8 +11,8 @@ from project_config.test_project_config import configured from plan.test_ranking import DECISIONS, OLD_SHAPE, README, TODO from project_config.settings import DEFAULT_FLOOR from plan import goals_file, ranking -from todo_item.test_todo_item import READABLE_TOUCHES, UNREADABLE_BULLETS import rank_todo +from todo_item.test_todo_item import READABLE_TOUCHES, UNREADABLE_BULLETS class Main(unittest.TestCase): diff --git a/bin/todo_item/main.py b/bin/todo_item/main.py index 28115281..d98f88db 100644 --- a/bin/todo_item/main.py +++ b/bin/todo_item/main.py @@ -91,10 +91,10 @@ from project_config.main import located from plan_store.plans import no_item, PlanStore, TAGLINE, Written from plan.release import parsed, Release, version as release_version from plan_store.stores import store as plan_store +from plan.touches import predicted from record_store.stores import RecordStore, store from todo_item.table import shown, table from todo_item.edits import with_bullet -from touch_predictions.prediction import predicted # Each score flag, as --l or --L, and the field it sets. LETTERS = ("L", "E", "I", "S") diff --git a/bin/touch_predictions/beside.py b/bin/touch_predictions/beside.py index 5acae9cd..493932b6 100644 --- a/bin/touch_predictions/beside.py +++ b/bin/touch_predictions/beside.py @@ -3,7 +3,7 @@ import dataclasses from failure import Failure from plan.todo_table import Item, waiting -from touch_predictions.prediction import LABEL, overlaps, predicted, Touches +from plan.touches import LABEL, overlaps, predicted, Touches @dataclasses.dataclass(frozen=True) diff --git a/bin/touch_predictions/diff_parts.py b/bin/touch_predictions/diff_parts.py index cd9d08d0..eef99821 100644 --- a/bin/touch_predictions/diff_parts.py +++ b/bin/touch_predictions/diff_parts.py @@ -3,7 +3,7 @@ import re from failure import Failure from git_cli.git_repo import git, Git -from touch_predictions.prediction import Part, Touches +from plan.touches import Part, Touches from touch_predictions.file_parts import part_names HUNK = re.compile(r"^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@", re.M) diff --git a/bin/touch_predictions/main.py b/bin/touch_predictions/main.py index c24d79c6..2c77b66a 100644 --- a/bin/touch_predictions/main.py +++ b/bin/touch_predictions/main.py @@ -49,7 +49,7 @@ import typing from git_cli.git_repo import default_ref, git, Git from failure import Failure from plan_store.stores import store as plan_store -from touch_predictions.prediction import predicted, together, Touches +from plan.touches import predicted, together, Touches from project_config.main import project from project_config.settings import ProjectConfig, TOUCH_PREDICTIONS from touch_predictions import record diff --git a/bin/touch_predictions/record.py b/bin/touch_predictions/record.py index d0c1f2fc..bf34afeb 100644 --- a/bin/touch_predictions/record.py +++ b/bin/touch_predictions/record.py @@ -3,7 +3,7 @@ import re from failure import Failure from record_store.stores import RecordStore -from touch_predictions.prediction import rendered, Touches +from plan.touches import rendered, Touches from text_files.utc_stamp import STAMPED TITLE = "# Touch predictions" diff --git a/bin/touch_predictions/test_touch_predictions.py b/bin/touch_predictions/test_touch_predictions.py index 6d15f982..3c79fe27 100644 --- a/bin/touch_predictions/test_touch_predictions.py +++ b/bin/touch_predictions/test_touch_predictions.py @@ -16,7 +16,7 @@ from failure import Failure from test_env import isolated_env from project_config.main import located from record_store.fakes import MemoryStore -from touch_predictions.prediction import overlaps, Part, predicted, rendered, together +from plan.touches import overlaps, Part, predicted, rendered, together from plan_store.todo_md import plan_of from project_config.settings import ProjectConfig from project_config.test_project_config import write_config diff --git a/todo.md b/todo.md index fb3a0516..270eadbe 100644 --- a/todo.md +++ b/todo.md @@ -272,7 +272,7 @@ Touches: On 2026-11-18 six items (400, 401, 416, 420, 421 and 422) held `Touches:` lists that touch-predictions cannot read, such as ``- `bin/judge_replay/main.py` (small)`` and ``- `README.md`: loop-claude's section (small)``. chunk-preflight reads the lists first, so loop-claude silently started nothing beside item 401, and slots sat idle for over an hour; the same mistake had been fixed by hand on 2026-11-16 (commit 4b508615). Nothing checked a list when it was written. -Both checks call `predicted` from `bin/touch_predictions/prediction.py`, so they cannot drift from the reader; its spelling stays as it is. `todo-item add` and `edit --detail` refuse such a detail, writing nothing, in main.py before the plan's backend gets it, so a plan in Jira is held to it too. `rank_todo.py --check` fails on any item in todo.md whose list it cannot read, naming the item and the reason. Moves 1.5 (delivery speed): idle chunk slots are what the mistake cost. +Both checks call `predicted`, so they cannot drift from the reader; its spelling stays as it is. The reader moves from `bin/touch_predictions/prediction.py` to `bin/plan/touches.py`, since touch_predictions imports plan_store and plan_store's check needs the reader. `todo-item add` and `edit --detail` refuse such a detail, writing nothing, in main.py before the plan's backend gets it, so a plan in Jira is held to it too. `rank_todo.py --check` fails on any item in todo.md whose list it cannot read, naming the item and the reason. Moves 1.5 (delivery speed): idle chunk slots are what the mistake cost. Touches: @@ -281,6 +281,8 @@ Touches: - `bin/plan_store/todo_md.py`: `FilePlan.check` - `bin/test_rank_todo.py` - `bin/rank_todo.py`: `(module)` (small) +- `bin/plan/touches.py` +- `bin/touch_predictions/prediction.py` - `rules/todo-items.md`: `` # Todo items (`todo.md`) `` (small) ### 316. 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. From aa34fb89126adefd8fdfffb7aa892456524e1928 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:21:46 +0100 Subject: [PATCH 09/26] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20cite=20why?= =?UTF-8?q?=20the=20stamp=20holds=20and=20scope=20the=20later=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/decisions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/decisions.md b/docs/decisions.md index abc688c8..43b45ac1 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -686,7 +686,7 @@ A project's rung is its model's cheapest rung, which for Opus 5.5 is its default 2026-11-15, lilleman asked for the ladder as a file that a project can replace, on a day when an outage left only Fable 5.2 answering: the rungs were a constant in `bin/model_routing/ladder.py`, so no project could leave Sonnet 5.5 and Opus 5.5 without a release. The shipped ladder is `bin/model_routing/routing-ladder.json`, a JSON list of rungs, least competent first. A project that keeps a `routing-ladder.json` in its config's folder, `~/.claude-projects//`, runs on that ladder whole, and the steps count on it as on the shipped one. Every project still runs the same routing rules and steps, so the workflow of goal 1.3 holds; the ladder joins what a project's config folder may supply, which that goal's list does not name yet. lilleman chose a file per project over one per machine, so a single project can differ. A ladder holds one model of each family, since the Agent tool launches a subagent or a review by its family's name. The project's file is lilleman's to write, as any change to the ladder is, and the loop never commits it. loop-claude reads the project's ladder as each cycle starts; `subagent-rung` and rule-hook's `reviewer-rung` read it each time they run, from the checkout they run in. A ladder file that holds a fault stops each of them, since work routed on the shipped ladder in its place could run on a model the project cannot reach. The routing figures, `judge-replay` and `review-replay` span every project, so they read the shipped ladder: a rung only a project's own ladder holds is left out of the figures' calls, and no replay qualifies it. lilleman shipped the change as 0.10.1, a patch cut from the tag v0.10.0, on the day of the outage: it adds a file format and an exit 1 to `subagent-rung`, which the technical principles' semantic versioning gives a minor, and lilleman asked for the patch "even if that breaks semver", so that the release in use could run again without taking the unreleased work on `main`. -2026-11-18, lilleman kept the ladder and the steps as they are, settling the call raised on the routing figures measured at 2026-11-18T15:04:48Z: chunks routed onto Sonnet 5.5 at high took more review rounds past each pass's first than chunks routed onto Opus 5.5 at medium. When lilleman ruled, `routing-calls-raised.md` held no line for that call, so this note cites the time the figures were measured. The figures came from 19 chunks finished since the 2026-11-17 reset. The 13 chunks started on Sonnet 5.5 at high took a mean 0.5 rounds, 0.0 unfinished verdicts and 0.0 later fixes. The 6 started on Opus 5.5 at medium took 0.5, 0.2 and 0.0. Both means round to 0.5, so the gap in rounds is under 0.1. Sonnet 5.5 did better on unfinished verdicts, and it is the cheaper rung (goal 1.4). +2026-11-18, lilleman kept the ladder and the steps, settling the call raised on the routing figures measured at 2026-11-18T15:04:48Z: chunks routed onto Sonnet 5.5 at high took more review rounds past each pass's first than chunks routed onto Opus 5.5 at medium. The figures came from 19 chunks finished since the 2026-11-17 reset. The 13 chunks started on Sonnet 5.5 at high took a mean 0.5 rounds and 0.0 unfinished verdicts; the 6 started on Opus 5.5 at medium took 0.5 and 0.2. Neither rung had later fixes, among the 11 and the 4 chunks whose later fixes are known. Both means show 0.5, so the gap is under 0.1 rounds. Sonnet 5.5 did better on unfinished verdicts, and it is the cheaper rung (goal 1.4). loop-claude lists the call in `routing-calls-raised.md` only once the session that put it to lilleman ends, stamped with the time the figures were measured, so this note cites that time. Valid while the index ranks these models, and while no newer model joins the catalog. From e82e5c38763a7ab0de4c9b9147d44c314bbdddf6 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:24:55 +0100 Subject: [PATCH 10/26] Score an epic's items by one chain of goals and order them by score, then blockers --- README.md | 2 +- bin/do_epic/ranking.py | 104 ++++++++++++++++++++++++++++++++++ bin/do_epic/test_ranking.py | 109 ++++++++++++++++++++++++++++++++++++ bin/plan/todo_table.py | 5 +- docs/reading-cost.md | 34 +++++++++++ todo.md | 2 +- 6 files changed, 253 insertions(+), 3 deletions(-) create mode 100644 bin/do_epic/ranking.py create mode 100644 bin/do_epic/test_ranking.py diff --git a/README.md b/README.md index fe62dce9..87ba37c6 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes` and `routing_figures`. It imports `reading_cost`'s record path. - `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`. - `deploy_release` imports `release_plan`'s `release_standing`. -- `do_epic/` will hold the tool that drives one Jira epic. So far `config.py` reads its machine-wide settings, importing `project_config`'s settings and `model_routing`'s ladder file, and `epic_record.py` reads and writes an epic's description by section and language line, through `record_store`'s `EpicDescription`. `repos.py` finds a repo's checkout and project config by its name, and clones a missing checkout from the host and owner of the epic's other repos, through `forge`'s `url_beside`. `repo_pick.py` asks claude, by `repo-rule.md`, where an epic item is worked, and records the answer as a label on the issue. `backend/` reads and files the epic's issues and adds those labels. +- `do_epic/` will hold the tool that drives one Jira epic. So far `config.py` reads its machine-wide settings, importing `project_config`'s settings and `model_routing`'s ladder file, and `epic_record.py` reads and writes an epic's description by section and language line, through `record_store`'s `EpicDescription`. `repos.py` finds a repo's checkout and project config by its name, and clones a missing checkout from the host and owner of the epic's other repos, through `forge`'s `url_beside`. `repo_pick.py` asks claude, by `repo-rule.md`, where an epic item is worked, and records the answer as a label on the issue. `ranking.py` orders an epic's items by score over one chain of goals, the epic's, then code health, then the item's repo's, through `plan`'s ranking. `backend/` reads and files the epic's issues and adds those labels. - `forge/` tells a GitHub origin from a Gitea one, names a repo beside an origin's and runs that forge's CLI (`commands.py`), and finds a pull request and waits for its checks (`pulls.py`), for `chunk_preflight`, `chunk_pr`, `deploy_release`, `do_epic` and `larv_review`. - `git_cli/` runs git for every tool (`git_repo.py`), and reads the git calls in a shell command (`git_command.py`). - `judge_replay` imports `loop_claude`'s judge, verdicts, premises and records. diff --git a/bin/do_epic/ranking.py b/bin/do_epic/ranking.py new file mode 100644 index 00000000..31217750 --- /dev/null +++ b/bin/do_epic/ranking.py @@ -0,0 +1,104 @@ +"""The order do-epic works an epic's items in: by score, then each blocker above what it blocks (docs/decisions.md → `do-epic: drives one Jira epic …`). + +An item scores by the epic's formula over one chain of goals: the epic's goals, then code health, then the goals of the item's repo. plan/goals_file.py's goal_weights weighs the chain as it weighs one project's goals, so a goal of the epic outweighs every goal of a repo. An item without a repo has only the epic's goals. + +The epic and each repo number their goals from 1, so an item's Moves names a goal by its scope: `epic 1.1 by 8, code health by 5, repo 2 by 4`.""" +import ast +import dataclasses +import decimal + +from failure import Failure +from plan import ranking +from plan.blockers import blockers_first +from plan.formula import parse_formula +from plan.goals_file import goal_weights, Mark, numbered, ranked_goals +from plan.todo_table import CODE_HEALTH, EPIC_GOAL, Item, REPO_GOAL, SHAPE +from review_rules.comprehension_history import latest_overall + +MARK_IT = "is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says" + + +@dataclasses.dataclass(frozen=True) +class RepoPremises: + """What a repo's own plan is ranked by: its goals file, its decision log and comprehension history, each as text, and its readability floor.""" + goals_text: str + decisions: str + history: str + floor: decimal.Decimal + + +@dataclasses.dataclass(frozen=True) +class EpicItem: + """One of an epic's open items. An epic item has no release, so every item of one epic holds the same one. repo is the name of the repo it is worked in; None where it has none.""" + item: Item + repo: str | None + + +def ranked(items: list[EpicItem], formula: str, epic_goals: str, repos: dict[str, RepoPremises]) -> list[tuple[Item, float]] | Failure: + """Each item with its score: a question first, then a security finding, then by score from highest, then by ID, and then each blocker above every item it blocks. formula is the epic's, epic_goals the text under its ## Goals, and repos the premises of each repo an item is in, by name.""" + parsed = parse_formula(formula, ranking.variables(SHAPE)) + if isinstance(parsed, Failure): + return parsed + scorings: dict[str | None, ranking.Scoring] = {} + scored = [] + for each in items: + name = f"item {each.item.id}" + if each.repo not in scorings: + if each.repo is not None and each.repo not in repos: + return Failure(f"{name} is in the repo {each.repo}, whose goals were not read") + scoring = chain_scoring(parsed, epic_goals, each.repo, repos.get(each.repo or "")) + if isinstance(scoring, Failure): + return scoring + scorings[each.repo] = scoring + value = unnamed_goal(each, scorings[each.repo], name) or ranking.item_score(each.item, scorings[each.repo], name) + if isinstance(value, Failure): + return value + scored.append((each.item, value)) + scored.sort(key=lambda pair: (ranking.FIRST.get(pair[0].exempt, len(ranking.FIRST)), -pair[1], pair[0].id)) + return blockers_first(scored) + + +def chain_scoring(formula: ast.Expression, epic_goals: str, repo: str | None, premises: RepoPremises | None) -> ranking.Scoring | Failure: + """How an item in repo scores: the chain's goals, each achieve goal at its weight. The bar is 0, since the bar decides what is filed, not the order of what was.""" + goals = chain(epic_goals, repo, premises) + if isinstance(goals, Failure): + return goals + if unmarked := next((goal for goal, mark in goals if mark is None), None): + whose, _, number = unmarked.partition(" ") + return Failure(f"{'the epic' if whose == 'epic' else repo}'s goal {number} {MARK_IT}") + overall = latest_overall(premises.history) if premises and CODE_HEALTH in dict(goals) else None + if isinstance(overall, Failure): + return Failure(f"{repo}: {overall.reason}") + weights = goal_weights(goals, overall, premises.floor if premises else decimal.Decimal(0)) + return weights if isinstance(weights, Failure) else ranking.Scoring(SHAPE, formula, 0, 0, dict(goals), weights) + + +def chain(epic_goals: str, repo: str | None, premises: RepoPremises | None) -> list[tuple[str, Mark]] | Failure: + """Every goal an item may name, in rank order, each with its mark: the epic's goals as `epic `, then, for an item in repo, which has these premises, code health unless the repo's goals file voids it, and the repo's goals as `repo `.""" + epic = numbered(epic_goals) + if isinstance(epic, Failure): + return Failure(epic.reason.replace("the goals file's", "the epic's")) + scoped = [(f"{EPIC_GOAL}{number}", mark) for number, mark in epic] + if premises is None: + return scoped + own = ranked_goals(premises.goals_text, premises.decisions) + if isinstance(own, Failure): + return Failure(f"{repo}: {own.reason}") + return [*scoped, *((goal if goal == CODE_HEALTH else f"{REPO_GOAL}{goal}", mark) for goal, mark in own)] + + +def unnamed_goal(each: EpicItem, scoring: ranking.Scoring, name: str) -> Failure | None: + """Why the item may not name one of the goals it names, in the epic's terms; None where its chain holds each.""" + for goal, _ in each.item.moves: + if goal in scoring.goals: + continue + if not goal.startswith((EPIC_GOAL, REPO_GOAL)) and goal != CODE_HEALTH: + return Failure(f"{name} names goal {goal} without saying whose it is; write `{EPIC_GOAL}{goal}` for the epic's goal or `{REPO_GOAL}{goal}` for its repo's") + if goal.startswith(EPIC_GOAL): + return Failure(f"{name} names {goal}, which the epic's ## Goals does not number") + if each.repo is None: + return Failure(f"{name} names {goal}, but has no repo whose {'code' if goal == CODE_HEALTH else 'goal'} that could be; name only the epic's goals, as in `{EPIC_GOAL}1 by 5`") + if goal == CODE_HEALTH: + return Failure(f"{name} names {CODE_HEALTH}, which {each.repo}'s goals file voids") + return Failure(f"{name} names {goal}, which the ## Goals of {each.repo}'s goals file does not number") + return None diff --git a/bin/do_epic/test_ranking.py b/bin/do_epic/test_ranking.py new file mode 100644 index 00000000..96ec1eb9 --- /dev/null +++ b/bin/do_epic/test_ranking.py @@ -0,0 +1,109 @@ +import decimal +import pathlib +import sys +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from do_epic.ranking import chain, EpicItem, ranked, RepoPremises +from failure import Failure +from plan.todo_table import Item, parse_moves + +EPIC_GOALS = "1. **Achieve:** Ship invoices.\n2. **Achieve:** Cut support mail.\n3. **Maintain:** Leak no customer data.\n" +VOIDED = RepoPremises("## Goals\n\n**Void:** code health, since it is a one-off script.\n\n1. **Achieve:** Fast builds.\n", "", "", decimal.Decimal("7.0")) +HEALTHY = RepoPremises("## Goals\n\n1. **Achieve:** Fast builds.\n2. **Maintain:** Stay on the LTS.\n", "", "", decimal.Decimal("7.0")) +# What the three achieve goals of the chain epic 1, epic 2, repo 1 weigh together before they are scaled to sum to 1, each 0.97 of the one above. +TOTAL = 1 + 0.97 + 0.97**2 + + +def item(id_: int, moves: str, repo: str | None = "billing-api", exempt: str = "", blocked_by: tuple[int, ...] = ()) -> EpicItem: + parsed = parse_moves(f"item {id_}", moves) + assert not isinstance(parsed, Failure), parsed + return EpicItem(Item(id_, (0, 0, 0), exempt, f"**Item {id_}.**", {"L": 1, "E": 1, "I": 1, "S": 1}, parsed, blocked_by), repo) # type: ignore[arg-type] + + +def order(items: list[EpicItem], repos: dict[str, RepoPremises], formula: str = "V") -> list[int] | Failure: + found = ranked(items, formula, EPIC_GOALS, repos) + return found if isinstance(found, Failure) else [scored.id for scored, _ in found] + + +class MovesSpellingTest(unittest.TestCase): + def test_a_moves_cell_names_an_epics_goal_and_a_repos_goal_by_their_scope(self) -> None: + self.assertEqual(parse_moves("item 1", "epic 1.1 by 8, code health by 5, repo 2 by 4"), (("epic 1.1", 8), ("code health", 5), ("repo 2", 4))) + + def test_a_moves_cell_refuses_an_epic_goal_beside_its_own_sub_goal(self) -> None: + self.assertIsInstance(parse_moves("item 1", "epic 1 by 8, epic 1.1 by 5"), Failure) + self.assertEqual(parse_moves("item 1", "epic 1 by 8, repo 1.1 by 5"), (("epic 1", 8), ("repo 1.1", 5))) + + +class ChainTest(unittest.TestCase): + def test_the_chain_is_the_epics_goals_then_code_health_then_the_repos_goals(self) -> None: + self.assertEqual(chain(EPIC_GOALS, "web", HEALTHY), [("epic 1", "Achieve"), ("epic 2", "Achieve"), ("epic 3", "Maintain"), ("code health", "Achieve"), ("repo 1", "Achieve"), ("repo 2", "Maintain")]) + + def test_a_repo_that_voids_code_health_leaves_it_out_of_its_chain(self) -> None: + self.assertEqual(chain(EPIC_GOALS, "billing-api", VOIDED), [("epic 1", "Achieve"), ("epic 2", "Achieve"), ("epic 3", "Maintain"), ("repo 1", "Achieve")]) + + def test_an_item_without_a_repo_weighs_only_the_epics_goals(self) -> None: + self.assertEqual(chain(EPIC_GOALS, None, None), [("epic 1", "Achieve"), ("epic 2", "Achieve"), ("epic 3", "Maintain")]) + + def test_an_epic_without_a_numbered_goal_fails(self) -> None: + self.assertEqual(chain("Ship it.\n", None, None), Failure("the epic's ## Goals has no numbered goal")) + + +class RankedTest(unittest.TestCase): + def test_each_goal_weighs_0_97_of_the_one_above_it_in_the_chain(self) -> None: + found = ranked([item(1, "repo 1 by 10"), item(2, "epic 2 by 10"), item(3, "epic 1 by 10")], "V", EPIC_GOALS, {"billing-api": VOIDED}) + assert not isinstance(found, Failure), found + self.assertEqual([scored.id for scored, _ in found], [3, 2, 1]) + for (_, value), expected in zip(found, (10 / TOTAL, 9.7 / TOTAL, 10 * 0.97**2 / TOTAL)): + self.assertAlmostEqual(value, expected) + + def test_where_the_epic_and_a_repo_disagree_the_epic_wins(self) -> None: + self.assertEqual(order([item(1, "repo 1 by 5"), item(2, "epic 2 by 5")], {"billing-api": VOIDED}), [2, 1]) + + def test_items_of_two_repos_rank_in_one_order_each_by_its_own_repos_chain(self) -> None: + repos = {"billing-api": VOIDED, "web": HEALTHY} + self.assertEqual(order([item(1, "repo 1 by 5"), item(2, "repo 1 by 6", repo="web"), item(3, "epic 1 by 9", repo="web")], repos, "V * 0 + S + I"), [1, 2, 3]) + self.assertEqual(order([item(1, "repo 1 by 5"), item(2, "repo 2 by 9", repo="web")], repos), [2, 1]) + + def test_an_item_without_a_repo_scores_by_the_epics_goals_alone(self) -> None: + found = ranked([item(1, "epic 1 by 10", repo=None)], "V", EPIC_GOALS, {}) + assert not isinstance(found, Failure), found + self.assertAlmostEqual(found[0][1], 10 / 1.97) + + def test_an_item_without_a_repo_may_not_name_a_repos_goal_or_code_health(self) -> None: + self.assertEqual(order([item(4, "repo 1 by 5", repo=None)], {}), Failure("item 4 names repo 1, but has no repo whose goal that could be; name only the epic's goals, as in `epic 1 by 5`")) + self.assertEqual(order([item(4, "code health by 5", repo=None)], {}), Failure("item 4 names code health, but has no repo whose code that could be; name only the epic's goals, as in `epic 1 by 5`")) + + def test_a_goal_without_its_scope_is_refused(self) -> None: + self.assertEqual(order([item(4, "1 by 5")], {"billing-api": VOIDED}), Failure("item 4 names goal 1 without saying whose it is; write `epic 1` for the epic's goal or `repo 1` for its repo's")) + + def test_a_goal_the_chain_does_not_hold_is_refused(self) -> None: + self.assertEqual(order([item(4, "epic 9 by 5")], {"billing-api": VOIDED}), Failure("item 4 names epic 9, which the epic's ## Goals does not number")) + self.assertEqual(order([item(4, "repo 9 by 5")], {"billing-api": VOIDED}), Failure("item 4 names repo 9, which the ## Goals of billing-api's goals file does not number")) + self.assertEqual(order([item(4, "code health by 5")], {"billing-api": VOIDED}), Failure("item 4 names code health, which billing-api's goals file voids")) + + def test_an_item_in_a_repo_without_premises_fails(self) -> None: + self.assertEqual(order([item(4, "epic 1 by 5", repo="ghost")], {}), Failure("item 4 is in the repo ghost, whose goals were not read")) + + def test_a_goal_marked_neither_way_fails_naming_whose_it_is(self) -> None: + unmarked = RepoPremises("## Goals\n\n1. Fast builds.\n", "", "", decimal.Decimal("7.0")) + self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": unmarked}), Failure("billing-api's goal 1 is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says")) + found = ranked([item(4, "epic 1 by 5", repo=None)], "V", "1. Ship invoices.\n", {}) + self.assertEqual(found, Failure("the epic's goal 1 is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says")) + + def test_a_repos_goals_file_that_cannot_be_read_fails_naming_the_repo(self) -> None: + self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": RepoPremises("# Billing\n", "", "", decimal.Decimal("7.0"))}), Failure("billing-api: the goals file has no ## Goals heading")) + + def test_a_question_then_a_security_finding_rank_before_any_score(self) -> None: + self.assertEqual(order([item(1, "epic 1 by 10"), item(2, "epic 2 by 1", exempt="security"), item(3, "", exempt="question")], {"billing-api": VOIDED}), [3, 2, 1]) + + def test_a_blocker_ranks_above_the_item_it_blocks_and_a_tie_goes_to_the_older_item(self) -> None: + self.assertEqual(order([item(1, "epic 1 by 9", blocked_by=(3,)), item(2, "epic 1 by 2"), item(3, "epic 1 by 1"), item(5, "epic 1 by 2")], {"billing-api": VOIDED}), [3, 1, 2, 5]) + + def test_a_formula_that_cannot_be_read_fails(self) -> None: + self.assertIsInstance(order([item(1, "epic 1 by 9")], {"billing-api": VOIDED}, "V +"), Failure) + + +if __name__ == "__main__": + unittest.main() diff --git a/bin/plan/todo_table.py b/bin/plan/todo_table.py index d28986d9..935b5ea8 100644 --- a/bin/plan/todo_table.py +++ b/bin/plan/todo_table.py @@ -22,6 +22,9 @@ BLOCKED_BY = "Blocked by" MOVES = "Moves" # The achieve goal every project shares, which ~/.claude/CLAUDE.md → "Shared goal" states, and a Moves cell names by these words, since it has no number in any goals file. CODE_HEALTH = "code health" +# What opens a goal's name in the Moves of an epic's item, whose epic and repo both number their goals from 1: `epic 1.1 by 8, code health by 5, repo 2 by 4`. Three readers, seated as the human who reads and writes these cells, picked a scope word on both over one on either alone and over the repo's name, 3-0. do_epic/ranking.py holds the goals such an item may name; a todo.md's item may name neither. +EPIC_GOAL = "epic " +REPO_GOAL = "repo " # How the items table's header opens, which tells it from any other table in todo.md. HEADER_START = "| ID | Release |" # todo.md's ## Details section, its body the first group. @@ -61,7 +64,7 @@ class Shape: def parse_moves(label: str, cell: str) -> Moves | Failure: """A Moves cell: empty, or each goal the item moves, named once, and how far. ranking.py's cited_goals_failure holds the rules that need the goals file.""" - matches = [re.fullmatch(rf"([0-9]+(?:\.[0-9]+)*|{CODE_HEALTH}) by ([0-9]+)", move) for move in cell.split(", ")] if cell else [] + matches = [re.fullmatch(rf"((?:{EPIC_GOAL}|{REPO_GOAL})?[0-9]+(?:\.[0-9]+)*|{CODE_HEALTH}) by ([0-9]+)", move) for move in cell.split(", ")] if cell else [] moves = tuple((match.group(1), int(match.group(2))) for match in matches if match) if len(moves) < len(matches) or any(not 1 <= by <= TOP_SCORE for _, by in moves): return Failure(f"{label}'s {MOVES} {cell!r} is not empty or goals such as `1.1 by 8, {CODE_HEALTH} by 5`, each moved by a whole number from 1 to {TOP_SCORE}") diff --git a/docs/reading-cost.md b/docs/reading-cost.md index f27e666e..1c136508 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2691,3 +2691,37 @@ Read most (opens and searches): - `bin/transcript_archive/outcomes.py` 2 - `bin/judge_replay/replay.py` 1 - `bin/rung_replay/archive.py` 1 + +## Reading cost, chunk f6452ae1f4d1, finished 2026-11-18T15:04:37Z + +164779 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 5 +- `CHANGELOG.md` 2 +- `bin/claude_code/reply.py` 2 +- `bin/do_epic/backend/contract.py` 2 +- `bin/do_epic/backend/jira.py` 2 +- `bin/do_epic/backend/test_jira.py` 2 +- `docs/decisions.md` 2 +- `bin/atlassian/client.py` 1 +- `bin/do_epic/backend/fake.py` 1 +- `bin/do_epic/backend/protocol.py` 1 + +## Reading cost, chunk a1d1adafc713, finished 2026-11-18T15:13:10Z + +257245 new input tokens before the first commit. + +Read most (opens and searches): + +- `docs/decisions.md` 11 +- `bin/review_replay/test_review_replay.py` 9 +- `bin/review_replay/replay.py` 7 +- `README.md` 6 +- `bin/review_replay/change_comparison.py` 5 +- `bin/rule_hook/test_rule_hook.py` 4 +- `bin/loop_claude/cycle/run.py` 2 +- `bin/loop_claude/test_loop_claude.py` 2 +- `bin/review_replay/main.py` 2 +- `bin/rule_hook/main.py` 2 diff --git a/todo.md b/todo.md index f533e3c8..3d2f2276 100644 --- a/todo.md +++ b/todo.md @@ -99,7 +99,7 @@ Touches: Where the epic and a repo disagree, the epic wins (`docs/decisions.md` → `do-epic: drives one Jira epic …`). An item without a repo weighs only the epic's goals. Build the chain as one list for `goal_weights`, score with `ranking.item_score` and order with `blockers_first`. `plan/ranking.py` `score` is a place the seats found hard, so the combiner must not add a branch to it. -The epic's and a repo's goal numbers collide, so a Moves cell needs a spelling for a repo's goal beside the epic's; a panel of readers picks it before it ships (`~/.claude/CLAUDE.md` → "Bench a syntax"). The scorer takes the items and each repo's goals as values; item 424 reads them from the tracker, and item 425 re-ranks Jira by the order. +The epic's and a repo's goal numbers collide, so a Moves cell needs a spelling for a repo's goal beside the epic's; a panel of readers picks it before it ships (`~/.claude/CLAUDE.md` → "Working loop"). The scorer takes the items and each repo's goals as values; item 424 reads them from the tracker, and item 425 re-ranks Jira by the order. Touches: From 76ae9da405f67d0fee232d821c50a895bedadfe5 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:30:07 +0100 Subject: [PATCH 11/26] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?gs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From c1d7ecf421feaa460a42cb06cd4feff95813c781 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:33:09 +0100 Subject: [PATCH 12/26] Test the scorer's code-health weight and each failure it names --- bin/do_epic/ranking.py | 3 ++- bin/do_epic/test_ranking.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/bin/do_epic/ranking.py b/bin/do_epic/ranking.py index 31217750..055a7a2b 100644 --- a/bin/do_epic/ranking.py +++ b/bin/do_epic/ranking.py @@ -46,7 +46,7 @@ def ranked(items: list[EpicItem], formula: str, epic_goals: str, repos: dict[str if each.repo not in scorings: if each.repo is not None and each.repo not in repos: return Failure(f"{name} is in the repo {each.repo}, whose goals were not read") - scoring = chain_scoring(parsed, epic_goals, each.repo, repos.get(each.repo or "")) + scoring = chain_scoring(parsed, epic_goals, each.repo, repos[each.repo] if each.repo else None) if isinstance(scoring, Failure): return scoring scorings[each.repo] = scoring @@ -69,6 +69,7 @@ def chain_scoring(formula: ast.Expression, epic_goals: str, repo: str | None, pr overall = latest_overall(premises.history) if premises and CODE_HEALTH in dict(goals) else None if isinstance(overall, Failure): return Failure(f"{repo}: {overall.reason}") + # goal_weights fails only on a goal without a mark, which the check above already named by whose it is. weights = goal_weights(goals, overall, premises.floor if premises else decimal.Decimal(0)) return weights if isinstance(weights, Failure) else ranking.Scoring(SHAPE, formula, 0, 0, dict(goals), weights) diff --git a/bin/do_epic/test_ranking.py b/bin/do_epic/test_ranking.py index 96ec1eb9..93ee16f0 100644 --- a/bin/do_epic/test_ranking.py +++ b/bin/do_epic/test_ranking.py @@ -1,3 +1,4 @@ +import dataclasses import decimal import pathlib import sys @@ -12,6 +13,8 @@ from plan.todo_table import Item, parse_moves EPIC_GOALS = "1. **Achieve:** Ship invoices.\n2. **Achieve:** Cut support mail.\n3. **Maintain:** Leak no customer data.\n" VOIDED = RepoPremises("## Goals\n\n**Void:** code health, since it is a one-off script.\n\n1. **Achieve:** Fast builds.\n", "", "", decimal.Decimal("7.0")) HEALTHY = RepoPremises("## Goals\n\n1. **Achieve:** Fast builds.\n2. **Maintain:** Stay on the LTS.\n", "", "", decimal.Decimal("7.0")) +# A scoring run of a repo whose overall mean is {overall}. +SCORED = "# Comprehension history\n\n## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\n| Seat | Overall |\n|---|---|\n| Mid A | 6 |\n| Mean | {overall} |\n" # What the three achieve goals of the chain epic 1, epic 2, repo 1 weigh together before they are scaled to sum to 1, each 0.97 of the one above. TOTAL = 1 + 0.97 + 0.97**2 @@ -95,6 +98,31 @@ class RankedTest(unittest.TestCase): def test_a_repos_goals_file_that_cannot_be_read_fails_naming_the_repo(self) -> None: self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": RepoPremises("# Billing\n", "", "", decimal.Decimal("7.0"))}), Failure("billing-api: the goals file has no ## Goals heading")) + def test_code_health_weighs_four_times_its_place_while_the_repo_is_unmeasured_or_under_its_floor(self) -> None: + total = 1 + 0.97 + 0.97**2 + 0.97**3 + for history, times in (("", 4), (SCORED.format(overall="6.9"), 4), (SCORED.format(overall="7.0"), 1)): + with self.subTest(history=history): + found = ranked([item(1, "code health by 10", repo="web"), item(2, "repo 1 by 10", repo="web")], "V", EPIC_GOALS, {"web": dataclasses.replace(HEALTHY, history=history)}) + assert not isinstance(found, Failure), found + self.assertAlmostEqual(found[0][1], times * 10 * 0.97**2 / total) + self.assertAlmostEqual(found[1][1], 10 * 0.97**3 / total) + + def test_a_repo_under_its_own_floor_weighs_code_health_by_that_floor(self) -> None: + found = ranked([item(1, "code health by 10", repo="web")], "V", EPIC_GOALS, {"web": dataclasses.replace(HEALTHY, history=SCORED.format(overall="7.5"), floor=decimal.Decimal("8.0"))}) + assert not isinstance(found, Failure), found + self.assertAlmostEqual(found[0][1], 4 * 10 * 0.97**2 / (1 + 0.97 + 0.97**2 + 0.97**3)) + + def test_a_history_that_cannot_be_read_fails_naming_the_repo(self) -> None: + found = order([item(1, "code health by 10", repo="web")], {"web": dataclasses.replace(HEALTHY, history=SCORED.format(overall="high"))}) + assert isinstance(found, Failure), found + self.assertTrue(found.reason.startswith("web: ") and len(found.reason) > len("web: None"), found.reason) + + def test_a_formula_that_gives_an_item_no_finite_score_fails_naming_the_item(self) -> None: + self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": VOIDED}, "10 ** 400 * V * 10 ** 400"), Failure("the formula gives item 4 no finite score")) + + def test_each_goal_an_item_names_is_checked(self) -> None: + self.assertEqual(order([item(4, "epic 1 by 5, repo 9 by 5")], {"billing-api": VOIDED}), Failure("item 4 names repo 9, which the ## Goals of billing-api's goals file does not number")) + def test_a_question_then_a_security_finding_rank_before_any_score(self) -> None: self.assertEqual(order([item(1, "epic 1 by 10"), item(2, "epic 2 by 1", exempt="security"), item(3, "", exempt="question")], {"billing-api": VOIDED}), [3, 2, 1]) From 86dbd03501f2cbfce2d7fe9f1d0c691f97bd6140 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:35:03 +0100 Subject: [PATCH 13/26] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=203=20=F0=9F=9F=A1=20(0=20misread);=20move=20the?= =?UTF-8?q?=20parser's=20tests=20beside=20it,=20index=20it=20in=20README,?= =?UTF-8?q?=20fix=20the=20claims=20about=20chunk-preflight?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- bin/plan/test_touches.py | 167 ++++++++++++++++++ bin/todo_item/main.py | 8 +- bin/todo_item/test_todo_item.py | 4 +- .../test_touch_predictions.py | 160 +---------------- docs/decisions.md | 2 +- 6 files changed, 176 insertions(+), 167 deletions(-) create mode 100644 bin/plan/test_touches.py diff --git a/README.md b/README.md index fe62dce9..ff5b8a2d 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `machine_load/` takes the machine's heavy slots, its shared lock files, for `run_heavy` and `adf_codec`, and reads the memory share that loop-claude waits for. It also gives `mutate_changes` a slot's CPU count. - `model_routing/` holds the shipped routing ladder (`routing-ladder.json`) and its steps (`ladder.py`), and reads a ladder from that file or a project's own (`ladder_file.py`), for loop-claude, `rule_hook`, `do_epic`, both replay tools and `subagent-rung`. It finds a project's config folder through `project_config`. It also holds the list prices, which `routing_figures` and `transcript_archive` read. - `notifier/` sends the human a DM through the notifier a project's config names, for `notify` and for loop-claude through `loop_effects`. Its backends are `mattermost.py` and `slack.py`. -- `plan/` is the plan's core, and imports neither `plan_store` nor `release_plan`. It holds an item and the items table's format (`todo_table.py`), releases (`release.py`), the ranking (`ranking.py`, with its score formula in `formula.py` and its blocker order in `blockers.py`), the paths an item's text names (`named_paths.py`) and `citations.py`, which holds `todo.md` and `docs/decisions.md` to each other. `goals_file.py` reads the goals file's sections, goals and goal weights, for the ranking and for `loop_claude`'s premises. +- `plan/` is the plan's core, and imports neither `plan_store` nor `release_plan`. It holds an item and the items table's format (`todo_table.py`), releases (`release.py`), the ranking (`ranking.py`, with its score formula in `formula.py` and its blocker order in `blockers.py`), the paths an item's text names (`named_paths.py`), an item's `Touches:` prediction and where two overlap (`touches.py`), and `citations.py`, which holds `todo.md` and `docs/decisions.md` to each other. `goals_file.py` reads the goals file's sections, goals and goal weights, for the ranking and for `loop_claude`'s premises. - `plan_store/` reads and writes a project's plan through the store the project's config names (`stores.py`). Every backend meets `plans.py`'s `PlanStore`: a markdown file (`todo_md.py`, which also ranks and checks the file in place, with its text edits in `markdown_edits.py`) or a Jira epic (`jira_epic.py`). `scoring.py` reads the goal weights that both backends rank by. `contract.py` holds the tests every backend that writes must pass; `jira_epic.py` doesn't yet, and its own tests stand in for Jira. `fakes.py` holds a plan in memory. - `rank_todo.py`, `settings_filter.py` and `statusline.py` are tools of one file each, tested beside them. - `record_store/` reads and writes a project's records, each through the store the project's config names (`stores.py`): a markdown file, a Confluence Cloud page (`confluence_page.py`), or, for the goals, a Jira epic's description (`jira_description.py`). `contract.py` holds the tests every backend must pass, and `fakes.py` a store in memory that the tests of other tools use. diff --git a/bin/plan/test_touches.py b/bin/plan/test_touches.py new file mode 100644 index 00000000..d0e0b18d --- /dev/null +++ b/bin/plan/test_touches.py @@ -0,0 +1,167 @@ +import pathlib +import shutil +import subprocess +import sys +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from adf_codec import convert +from failure import Failure +from plan.touches import overlaps, Part, predicted, rendered, together + +DETAIL = """A planning call. + +Touches: + +- `bin/a.py`: `main`, `Plan.branch` (small) +- `README.md`: `## Goals, and (more): things` +- `bin/run.sh`: lines 10-20 +- `docs/new.md` + +More prose, with `bin/b.py` named. +""" + +needs_docker = unittest.skipIf(shutil.which("docker") is None or subprocess.run(["docker", "info"], capture_output=True, timeout=20).returncode != 0, "adf_codec runs in a container, which needs a docker daemon") + + +def text(words: str, code: bool = False) -> dict: + return {"type": "text", "text": words, **({"marks": [{"type": "code"}]} if code else {})} + + +def bullet_of(*spans: dict) -> dict: + return {"type": "listItem", "attrs": {"localId": "i"}, "content": [{"type": "paragraph", "attrs": {"localId": "p"}, "content": list(spans)}]} + + +# A Touches list as someone types it in Jira's editor: a paragraph, then a bulleted list whose paths and names carry the code mark. +JIRA_TOUCHES = {"type": "doc", "version": 1, "content": [ + {"type": "paragraph", "attrs": {"localId": "a"}, "content": [text("A planning call.")]}, + {"type": "paragraph", "attrs": {"localId": "b"}, "content": [text("Touches:")]}, + {"type": "bulletList", "attrs": {"localId": "c"}, "content": [ + bullet_of(text("bin/a.py", True), text(": "), text("main", True), text(", "), text("Plan.branch", True), text(" (small)")), + bullet_of(text("a`b.md", True), text(": "), text("## The `foo` tool", True), text(" (small)"), text(", "), text("`x`", True)), + bullet_of(text("bin/run.sh", True), text(": lines 10-20")), + bullet_of(text("docs/new.md", True)), + ]}, + {"type": "paragraph", "attrs": {"localId": "d"}, "content": [text("More prose.")]}, +]} + + +class PredictedTest(unittest.TestCase): + def test_reads_each_bullet_of_the_touches_list(self) -> None: + self.assertEqual(predicted(DETAIL), { + "bin/a.py": (Part("main"), Part("Plan.branch", small=True)), + "README.md": (Part("## Goals, and (more): things"),), + "bin/run.sh": (Part("lines 10-20"),), + "docs/new.md": (), + }) + + def test_a_detail_without_the_list_predicts_nothing(self) -> None: + self.assertIsNone(predicted("Only prose, with `bin/a.py` named.")) + + def test_a_bullet_it_cannot_read_is_a_failure_that_quotes_it(self) -> None: + for bullet in ("- bin/a.py: main", "- `bin/a.py`: main", "- `bin/a.py`: lines 20-10", "- `bin/a.py`: `main` `other`"): + with self.subTest(bullet): + found = predicted(f"Touches:\n\n{bullet}\n") + assert isinstance(found, Failure) + self.assertIn(bullet, found.reason) + + def test_an_empty_list_is_a_failure(self) -> None: + self.assertIsInstance(predicted("Touches:\n\nProse.\n"), Failure) + found = predicted("Touches:\n") + assert isinstance(found, Failure) + self.assertEqual(found.reason, "no bullet follows `Touches:`") + + def test_reads_a_list_right_under_its_label_a_one_line_range_and_a_name_of_any_letters(self) -> None: + self.assertEqual(predicted("Touches:\n- `a.py`: `Xray`, lines 5-5\n"), {"a.py": (Part("Xray"), Part("lines 5-5"))}) + + def test_rendered_reads_back(self) -> None: + touches = predicted(DETAIL) + assert isinstance(touches, dict) + self.assertEqual(predicted(f"Touches:\n\n{rendered(touches)}\n"), touches) + + def test_a_name_that_holds_backticks_takes_a_longer_run_with_a_space_inside_each_end(self) -> None: + self.assertEqual(predicted("Touches:\n- `a.md`: `` ## The `foo` tool `` (small), ``` `` ```, `` `x` ``\n"), {"a.md": (Part("## The `foo` tool", small=True), Part("``"), Part("`x`"))}) + self.assertEqual(rendered({"a.md": (Part("## The `foo` tool", small=True), Part("``"))}), "- `a.md`: `` ## The `foo` tool `` (small), ``` `` ```") + + def test_a_longer_run_without_padding_spaces_is_the_text_between_its_runs(self) -> None: + self.assertEqual(predicted("Touches:\n- ``a`b.md``: ``## The `foo` tool`` (small), ``` `` ```, `` `x` ``\n"), {"a`b.md": (Part("## The `foo` tool", small=True), Part("``"), Part("`x`"))}) + + def test_a_longer_run_with_a_space_at_one_end_only_keeps_it(self) -> None: + self.assertEqual(predicted("Touches:\n- `a.md`: `` x``, ``y ``, `` a ``\n"), {"a.md": (Part(" x"), Part("y "), Part("a"))}) + + @needs_docker + def test_a_list_written_in_markdown_and_read_back_from_a_jira_description_reads_as_written(self) -> None: + description = convert.markdown_to_adf(DETAIL) + assert isinstance(description, dict) + self.assertEqual(predicted(convert.adf_to_markdown(description)), predicted(DETAIL)) + + @needs_docker + def test_a_list_typed_in_jiras_editor_reads_as_its_files_and_parts(self) -> None: + read = convert.adf_to_markdown(JIRA_TOUCHES) + self.assertEqual(predicted(read), { + "bin/a.py": (Part("main"), Part("Plan.branch", small=True)), + "a`b.md": (Part("## The `foo` tool", small=True), Part("`x`")), + "bin/run.sh": (Part("lines 10-20"),), + "docs/new.md": (), + }) + + def test_a_name_ends_only_at_a_run_as_long_as_the_one_that_opens_it(self) -> None: + self.assertEqual(predicted("Touches:\n- `a.md`: `` a ``` b ``, `c``d`\n"), {"a.md": (Part("a ``` b"), Part("c``d"))}) + + def test_a_path_holds_any_character_and_a_single_backtick_keeps_a_names_spaces(self) -> None: + self.assertEqual(predicted("Touches:\n- `my file.md`: ` x `\n- `` a`b.md ``\n"), {"my file.md": (Part(" x "),), "a`b.md": ()}) + + def test_rendered_reads_back_whatever_a_path_or_a_name_holds(self) -> None: + touches = {"my file.md": (Part("## todo.md: under `Touches:` in its detail"), Part("## ``a`` and `b`", small=True), Part("`"), Part("## ends in `x`"), Part(" x "), Part("lines 2-3")), "a`b.md": (), "c, d: e.md": (Part("# T"),)} + self.assertEqual(predicted(f"Touches:\n\n{rendered(touches)}\n"), touches) + + def test_a_bullet_with_an_unclosed_run_a_blank_name_or_a_stray_separator_is_a_failure(self) -> None: + for bullet in ("- `a.md`: `` ## A", "- `a.md`: `` ## A `", "- `a.md`: `` ``", "- `a.md`: ", "- `a.md`:", "- `a.md`: `f`, ", "- `a.md`: `f`,`g`", "- ``", "- `a.md` (small)", "- `a.md`: `f` (small) (small)"): + with self.subTest(bullet): + self.assertIsInstance(predicted(f"Touches:\n\n{bullet}\n"), Failure) + + def test_a_range_that_runs_backwards_is_a_failure_that_says_so(self) -> None: + found = predicted("Touches:\n\n- `bin/a.py`: `f`, lines 20-10\n") + assert isinstance(found, Failure) + self.assertEqual(found.reason, "the bullet '- `bin/a.py`: `f`, lines 20-10' under `Touches:` holds a line range whose first line comes after its last") + + def test_together_joins_items_and_keeps_small_only_where_each_says_so(self) -> None: + joined = together([{"a.py": (Part("f", small=True), Part("g", small=True))}, {"a.py": (Part("f"),), "b.md": ()}, {"b.md": (Part("# T"),)}]) + self.assertEqual(joined, {"a.py": (Part("f"), Part("g", small=True)), "b.md": ()}) + + def test_together_keeps_a_part_not_small_once_one_says_so_and_reads_on_past_a_whole_file(self) -> None: + joined = together([{"a.py": (Part("f"),), "b.md": ()}, {"b.md": (Part("# T"),), "a.py": (Part("f", small=True),), "c.py": (Part("h"),)}]) + self.assertEqual(joined, {"a.py": (Part("f"),), "b.md": (), "c.py": (Part("h"),)}) + + +class OverlapsTest(unittest.TestCase): + def test_other_files_and_other_parts_do_not_overlap(self) -> None: + self.assertEqual(overlaps({"a.py": (Part("f"),)}, {"a.py": (Part("g"),), "b.py": ()}), []) + + def test_the_same_part_overlaps(self) -> None: + self.assertEqual(overlaps({"a.py": (Part("f"), Part("g"))}, {"a.py": (Part("g"),)}), ["`a.py` `g`"]) + + def test_a_class_overlaps_its_method_but_not_a_name_it_only_starts(self) -> None: + self.assertEqual(overlaps({"a.py": (Part("Plan"),)}, {"a.py": (Part("Plan.branch"), Part("Planned"))}), ["`a.py` `Plan`"]) + + def test_a_whole_file_overlaps_any_part_of_it(self) -> None: + self.assertEqual(overlaps({"a.py": ()}, {"a.py": (Part("g", small=True),)}), ["`a.py`"]) + + def test_reads_on_past_a_file_only_one_touches_and_past_a_whole_file(self) -> None: + theirs = {"a.py": (), "b.py": (Part("g"),)} + self.assertEqual(overlaps({"z.py": (Part("f"),), "a.py": (), "b.py": (Part("g"),)}, theirs), ["`a.py`", "`b.py` `g`"]) + + def test_line_ranges_overlap_where_they_share_a_line(self) -> None: + self.assertEqual(overlaps({"x.sh": (Part("lines 1-10"),)}, {"x.sh": (Part("lines 10-12"),)}), ["`x.sh` lines 1-10"]) + self.assertEqual(overlaps({"x.sh": (Part("lines 1-9"),)}, {"x.sh": (Part("lines 10-12"),)}), []) + self.assertEqual(overlaps({"x.sh": (Part("lines 10-12"),)}, {"x.sh": (Part("lines 1-10"),)}), ["`x.sh` lines 10-12"]) + self.assertEqual(overlaps({"x.sh": (Part("lines 11-12"),)}, {"x.sh": (Part("lines 1-10"),)}), []) + + def test_a_line_range_overlaps_a_named_part_since_nothing_tells_them_apart(self) -> None: + self.assertEqual(overlaps({"a.py": (Part("lines 1-9"),)}, {"a.py": (Part("f"),)}), ["`a.py` lines 1-9"]) + self.assertEqual(overlaps({"a.py": (Part("f"),)}, {"a.py": (Part("lines 1-9"),)}), ["`a.py` `f`"]) + + def test_a_small_change_on_either_side_is_taken(self) -> None: + self.assertEqual(overlaps({"a.py": (Part("f", small=True),)}, {"a.py": (Part("f"),)}), []) + self.assertEqual(overlaps({"a.py": (Part("f"),)}, {"a.py": (Part("f", small=True),)}), []) diff --git a/bin/todo_item/main.py b/bin/todo_item/main.py index d98f88db..a2e6d3e8 100644 --- a/bin/todo_item/main.py +++ b/bin/todo_item/main.py @@ -28,7 +28,7 @@ list and show read only the plan, and print no Score: an item's place in list's add files the item under the next free ID, with the tagline in bold, and the detail it reads from stdin, if any. The detail may hold no ## or ### heading. It prints `Filed item in .` It doesn't write anything where ranking fails or scores the item under the bar, -or where the detail holds a `Touches:` list that touch-predictions cannot read, as `touch-predictions --help` spells it. +or where the detail holds a `Touches:` list not spelt as `touch-predictions --help` shows. In a Jira epic, add files a Task under the epic, and is the new issue's number. The release must be one of the Jira project's Fix Versions, named as 1.2.0 or v1.2.0 there, and --exempt security also labels the issue `security`. The item scores by the config's `jira-score-formula`, and @@ -42,8 +42,8 @@ edit sets the cells whose flag is given and leaves the rest; an empty value, as empties the cell. --detail replaces the detail with the text on stdin, and --clear-detail removes it. Text on stdin without --detail, and --detail without text on stdin, are refused, so no detail is dropped or wiped by mistake. It prints `Edited item in .` It doesn't write anything where -ranking fails or scores the item under the bar, or where a new detail holds a `Touches:` list that -touch-predictions cannot read. +ranking fails or scores the item under the bar, or where a new detail holds a `Touches:` list not +spelt as `touch-predictions --help` shows. In a Jira epic, edit changes an issue the loop filed: its summary, description and scores, the label `security` with --exempt, and its "is blocked by" links with --blocked-by: it makes a link for each blocker added and deletes the link of each blocker dropped. Each blocker must be an open child of the @@ -199,7 +199,7 @@ def reported(written: Written | Failure, refusal: str, done: typing.Callable[[Wr def unreadable(detail: str | None, refusal: str) -> Failure | None: - """A Failure opened with refusal where detail holds a `Touches:` list touch-predictions cannot read; checked here, before the plan's backend gets the detail, so a plan in Jira is held to it too. chunk-preflight reads the list first, and on such a list starts no chunk beside the item without saying why.""" + """A Failure opened with refusal where detail holds a `Touches:` list touch-predictions cannot read; checked here, before the plan's backend gets the detail, so a plan in Jira is held to it too.""" read = None if detail is None else predicted(detail) return Failure(f"{refusal}: {read.reason}") if isinstance(read, Failure) else None diff --git a/bin/todo_item/test_todo_item.py b/bin/todo_item/test_todo_item.py index 13dd9496..0b9d2cd2 100644 --- a/bin/todo_item/test_todo_item.py +++ b/bin/todo_item/test_todo_item.py @@ -499,9 +499,9 @@ class Edit(TodoItem): class UnreadableTouches(TodoItem): - """A `Touches:` list touch-predictions cannot read is refused when written, since chunk-preflight would silently start no chunk beside the item.""" + """A `Touches:` list touch-predictions cannot read is refused when written, since loop-claude doesn't start any chunk beside an item whose list it cannot read.""" - def test_add_and_edit_refuse_each_bullet_that_stalled_the_loop_and_write_nothing(self): + def test_add_and_edit_refuse_each_bullet_that_stalled_the_loop(self): for bullet in UNREADABLE_BULLETS: for argv, refusal in ((ADD, "not filed: "), (["edit", "3", "--detail"], "not edited: item 3's detail: ")): with self.subTest(bullet=bullet, command=argv[0]): diff --git a/bin/touch_predictions/test_touch_predictions.py b/bin/touch_predictions/test_touch_predictions.py index 3c79fe27..e960c9a6 100644 --- a/bin/touch_predictions/test_touch_predictions.py +++ b/bin/touch_predictions/test_touch_predictions.py @@ -1,7 +1,6 @@ import os import pathlib import re -import shutil import subprocess import sys import tempfile @@ -10,53 +9,16 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from touch_predictions.beside import Beside, chunks_beside -from adf_codec import convert from touch_predictions import diff_parts, file_parts, main, record from failure import Failure from test_env import isolated_env from project_config.main import located from record_store.fakes import MemoryStore -from plan.touches import overlaps, Part, predicted, rendered, together +from plan.touches import Part from plan_store.todo_md import plan_of from project_config.settings import ProjectConfig from project_config.test_project_config import write_config -DETAIL = """A planning call. - -Touches: - -- `bin/a.py`: `main`, `Plan.branch` (small) -- `README.md`: `## Goals, and (more): things` -- `bin/run.sh`: lines 10-20 -- `docs/new.md` - -More prose, with `bin/b.py` named. -""" - -needs_docker = unittest.skipIf(shutil.which("docker") is None or subprocess.run(["docker", "info"], capture_output=True, timeout=20).returncode != 0, "adf_codec runs in a container, which needs a docker daemon") - - -def text(words: str, code: bool = False) -> dict: - return {"type": "text", "text": words, **({"marks": [{"type": "code"}]} if code else {})} - - -def bullet_of(*spans: dict) -> dict: - return {"type": "listItem", "attrs": {"localId": "i"}, "content": [{"type": "paragraph", "attrs": {"localId": "p"}, "content": list(spans)}]} - - -# A Touches list as someone types it in Jira's editor: a paragraph, then a bulleted list whose paths and names carry the code mark. -JIRA_TOUCHES = {"type": "doc", "version": 1, "content": [ - {"type": "paragraph", "attrs": {"localId": "a"}, "content": [text("A planning call.")]}, - {"type": "paragraph", "attrs": {"localId": "b"}, "content": [text("Touches:")]}, - {"type": "bulletList", "attrs": {"localId": "c"}, "content": [ - bullet_of(text("bin/a.py", True), text(": "), text("main", True), text(", "), text("Plan.branch", True), text(" (small)")), - bullet_of(text("a`b.md", True), text(": "), text("## The `foo` tool", True), text(" (small)"), text(", "), text("`x`", True)), - bullet_of(text("bin/run.sh", True), text(": lines 10-20")), - bullet_of(text("docs/new.md", True)), - ]}, - {"type": "paragraph", "attrs": {"localId": "d"}, "content": [text("More prose.")]}, -]} - PYTHON = """\"\"\"Docstring.\"\"\" import os @@ -98,126 +60,6 @@ Text. """ -class PredictedTest(unittest.TestCase): - def test_reads_each_bullet_of_the_touches_list(self) -> None: - self.assertEqual(predicted(DETAIL), { - "bin/a.py": (Part("main"), Part("Plan.branch", small=True)), - "README.md": (Part("## Goals, and (more): things"),), - "bin/run.sh": (Part("lines 10-20"),), - "docs/new.md": (), - }) - - def test_a_detail_without_the_list_predicts_nothing(self) -> None: - self.assertIsNone(predicted("Only prose, with `bin/a.py` named.")) - - def test_a_bullet_it_cannot_read_is_a_failure_that_quotes_it(self) -> None: - for bullet in ("- bin/a.py: main", "- `bin/a.py`: main", "- `bin/a.py`: lines 20-10", "- `bin/a.py`: `main` `other`"): - with self.subTest(bullet): - found = predicted(f"Touches:\n\n{bullet}\n") - assert isinstance(found, Failure) - self.assertIn(bullet, found.reason) - - def test_an_empty_list_is_a_failure(self) -> None: - self.assertIsInstance(predicted("Touches:\n\nProse.\n"), Failure) - found = predicted("Touches:\n") - assert isinstance(found, Failure) - self.assertEqual(found.reason, "no bullet follows `Touches:`") - - def test_reads_a_list_right_under_its_label_a_one_line_range_and_a_name_of_any_letters(self) -> None: - self.assertEqual(predicted("Touches:\n- `a.py`: `Xray`, lines 5-5\n"), {"a.py": (Part("Xray"), Part("lines 5-5"))}) - - def test_rendered_reads_back(self) -> None: - touches = predicted(DETAIL) - assert isinstance(touches, dict) - self.assertEqual(predicted(f"Touches:\n\n{rendered(touches)}\n"), touches) - - def test_a_name_that_holds_backticks_takes_a_longer_run_with_a_space_inside_each_end(self) -> None: - self.assertEqual(predicted("Touches:\n- `a.md`: `` ## The `foo` tool `` (small), ``` `` ```, `` `x` ``\n"), {"a.md": (Part("## The `foo` tool", small=True), Part("``"), Part("`x`"))}) - self.assertEqual(rendered({"a.md": (Part("## The `foo` tool", small=True), Part("``"))}), "- `a.md`: `` ## The `foo` tool `` (small), ``` `` ```") - - def test_a_longer_run_without_padding_spaces_is_the_text_between_its_runs(self) -> None: - self.assertEqual(predicted("Touches:\n- ``a`b.md``: ``## The `foo` tool`` (small), ``` `` ```, `` `x` ``\n"), {"a`b.md": (Part("## The `foo` tool", small=True), Part("``"), Part("`x`"))}) - - def test_a_longer_run_with_a_space_at_one_end_only_keeps_it(self) -> None: - self.assertEqual(predicted("Touches:\n- `a.md`: `` x``, ``y ``, `` a ``\n"), {"a.md": (Part(" x"), Part("y "), Part("a"))}) - - @needs_docker - def test_a_list_written_in_markdown_and_read_back_from_a_jira_description_reads_as_written(self) -> None: - description = convert.markdown_to_adf(DETAIL) - assert isinstance(description, dict) - self.assertEqual(predicted(convert.adf_to_markdown(description)), predicted(DETAIL)) - - @needs_docker - def test_a_list_typed_in_jiras_editor_reads_as_its_files_and_parts(self) -> None: - read = convert.adf_to_markdown(JIRA_TOUCHES) - self.assertEqual(predicted(read), { - "bin/a.py": (Part("main"), Part("Plan.branch", small=True)), - "a`b.md": (Part("## The `foo` tool", small=True), Part("`x`")), - "bin/run.sh": (Part("lines 10-20"),), - "docs/new.md": (), - }) - - def test_a_name_ends_only_at_a_run_as_long_as_the_one_that_opens_it(self) -> None: - self.assertEqual(predicted("Touches:\n- `a.md`: `` a ``` b ``, `c``d`\n"), {"a.md": (Part("a ``` b"), Part("c``d"))}) - - def test_a_path_holds_any_character_and_a_single_backtick_keeps_a_names_spaces(self) -> None: - self.assertEqual(predicted("Touches:\n- `my file.md`: ` x `\n- `` a`b.md ``\n"), {"my file.md": (Part(" x "),), "a`b.md": ()}) - - def test_rendered_reads_back_whatever_a_path_or_a_name_holds(self) -> None: - touches = {"my file.md": (Part("## todo.md: under `Touches:` in its detail"), Part("## ``a`` and `b`", small=True), Part("`"), Part("## ends in `x`"), Part(" x "), Part("lines 2-3")), "a`b.md": (), "c, d: e.md": (Part("# T"),)} - self.assertEqual(predicted(f"Touches:\n\n{rendered(touches)}\n"), touches) - - def test_a_bullet_with_an_unclosed_run_a_blank_name_or_a_stray_separator_is_a_failure(self) -> None: - for bullet in ("- `a.md`: `` ## A", "- `a.md`: `` ## A `", "- `a.md`: `` ``", "- `a.md`: ", "- `a.md`:", "- `a.md`: `f`, ", "- `a.md`: `f`,`g`", "- ``", "- `a.md` (small)", "- `a.md`: `f` (small) (small)"): - with self.subTest(bullet): - self.assertIsInstance(predicted(f"Touches:\n\n{bullet}\n"), Failure) - - def test_a_range_that_runs_backwards_is_a_failure_that_says_so(self) -> None: - found = predicted("Touches:\n\n- `bin/a.py`: `f`, lines 20-10\n") - assert isinstance(found, Failure) - self.assertEqual(found.reason, "the bullet '- `bin/a.py`: `f`, lines 20-10' under `Touches:` holds a line range whose first line comes after its last") - - def test_together_joins_items_and_keeps_small_only_where_each_says_so(self) -> None: - joined = together([{"a.py": (Part("f", small=True), Part("g", small=True))}, {"a.py": (Part("f"),), "b.md": ()}, {"b.md": (Part("# T"),)}]) - self.assertEqual(joined, {"a.py": (Part("f"), Part("g", small=True)), "b.md": ()}) - - def test_together_keeps_a_part_not_small_once_one_says_so_and_reads_on_past_a_whole_file(self) -> None: - joined = together([{"a.py": (Part("f"),), "b.md": ()}, {"b.md": (Part("# T"),), "a.py": (Part("f", small=True),), "c.py": (Part("h"),)}]) - self.assertEqual(joined, {"a.py": (Part("f"),), "b.md": (), "c.py": (Part("h"),)}) - - -class OverlapsTest(unittest.TestCase): - def test_other_files_and_other_parts_do_not_overlap(self) -> None: - self.assertEqual(overlaps({"a.py": (Part("f"),)}, {"a.py": (Part("g"),), "b.py": ()}), []) - - def test_the_same_part_overlaps(self) -> None: - self.assertEqual(overlaps({"a.py": (Part("f"), Part("g"))}, {"a.py": (Part("g"),)}), ["`a.py` `g`"]) - - def test_a_class_overlaps_its_method_but_not_a_name_it_only_starts(self) -> None: - self.assertEqual(overlaps({"a.py": (Part("Plan"),)}, {"a.py": (Part("Plan.branch"), Part("Planned"))}), ["`a.py` `Plan`"]) - - def test_a_whole_file_overlaps_any_part_of_it(self) -> None: - self.assertEqual(overlaps({"a.py": ()}, {"a.py": (Part("g", small=True),)}), ["`a.py`"]) - - def test_reads_on_past_a_file_only_one_touches_and_past_a_whole_file(self) -> None: - theirs = {"a.py": (), "b.py": (Part("g"),)} - self.assertEqual(overlaps({"z.py": (Part("f"),), "a.py": (), "b.py": (Part("g"),)}, theirs), ["`a.py`", "`b.py` `g`"]) - - def test_line_ranges_overlap_where_they_share_a_line(self) -> None: - self.assertEqual(overlaps({"x.sh": (Part("lines 1-10"),)}, {"x.sh": (Part("lines 10-12"),)}), ["`x.sh` lines 1-10"]) - self.assertEqual(overlaps({"x.sh": (Part("lines 1-9"),)}, {"x.sh": (Part("lines 10-12"),)}), []) - self.assertEqual(overlaps({"x.sh": (Part("lines 10-12"),)}, {"x.sh": (Part("lines 1-10"),)}), ["`x.sh` lines 10-12"]) - self.assertEqual(overlaps({"x.sh": (Part("lines 11-12"),)}, {"x.sh": (Part("lines 1-10"),)}), []) - - def test_a_line_range_overlaps_a_named_part_since_nothing_tells_them_apart(self) -> None: - self.assertEqual(overlaps({"a.py": (Part("lines 1-9"),)}, {"a.py": (Part("f"),)}), ["`a.py` lines 1-9"]) - self.assertEqual(overlaps({"a.py": (Part("f"),)}, {"a.py": (Part("lines 1-9"),)}), ["`a.py` `f`"]) - - def test_a_small_change_on_either_side_is_taken(self) -> None: - self.assertEqual(overlaps({"a.py": (Part("f", small=True),)}, {"a.py": (Part("f"),)}), []) - self.assertEqual(overlaps({"a.py": (Part("f"),)}, {"a.py": (Part("f", small=True),)}), []) - - class FilePartsTest(unittest.TestCase): def names(self, path: str, text: str, *lines: int) -> set[str] | None: return file_parts.part_names(path, text, lines) diff --git a/docs/decisions.md b/docs/decisions.md index 1181ce2f..27accc7f 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -804,7 +804,7 @@ Valid while the worker writes the tests that larv-review's reviewers hold to the ## todo.md: an item of the next release predicts the files and parts it will touch under `Touches:` in its detail; chunk-preflight takes, in the plan's order, the items that overlap none taken before them as the chunks that may run at once, and the optional `touch-predictions` record keeps each chunk's prediction beside what it touched -2026-11-15, lilleman's call of 2026-11-13 in item 373, which split item 361. Serves goal 1.5, held to goal 1.4: several chunks of one project run at once only where they are unlikely to touch the same lines, since a conflict costs a rebase, a gate rerun and often a review round. A session on the project's rung or above writes each prediction, as `rules/todo-items.md` says, and `bin/touch_predictions/` reads it. The choices the call left open: +2026-11-15, lilleman's call of 2026-11-13 in item 373, which split item 361. Serves goal 1.5, held to goal 1.4: several chunks of one project run at once only where they are unlikely to touch the same lines, since a conflict costs a rebase, a gate rerun and often a review round. A session on the project's rung or above writes each prediction, as `rules/todo-items.md` says, and `bin/plan/touches.py` reads it. The choices the call left open: - **The spelling.** A `Touches:` line, then one bullet per file: the path in backticks, then its parts, each a name in backticks or `lines -`, with `(small)` after a part the item changes only a little; a path or a name that holds a backtick takes a longer run of backticks with a space inside each end, as a Markdown code span does. A path alone is the whole file. Three readers seated as the README's audience picked the bulleted list over one line and over a table, since backticks hold a heading's commas, colons and parentheses. Two of the three put `(small)` after the part and outside the backticks, and two left line ranges unquoted. Each picked a different config key: `touch-predictions` was one reader's first choice and the second choice of the other two. - **A part's boundaries.** Python's `ast` module names the innermost function or class, a top-level assignment by the name it sets, and `(module)` for the rest. A Markdown file's parts are its headings outside fenced code. Any other file, and Python that doesn't parse, falls back to line ranges. A table row is no part of its own: the item named one, but the tables chunks collide on are the plan's and the changelog's, which don't count. From 8f1d28f1602d40c2f64ff754fbb2cae8b01c330c Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:35:03 +0100 Subject: [PATCH 14/26] =?UTF-8?q?Answer=20product-owner=20round=201:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20say=20wh?= =?UTF-8?q?ere=20(small)=20goes=20in=20the=20refusal,=20file=20item=20425?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/plan/touches.py | 4 ++-- todo.md | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bin/plan/touches.py b/bin/plan/touches.py index 8dfa9e73..54e87e1a 100644 --- a/bin/plan/touches.py +++ b/bin/plan/touches.py @@ -1,6 +1,6 @@ """An item's prediction of the files and parts it will touch, as its detail spells it, and where two predictions overlap. -It sits in plan, beside the items whose details it reads, so that plan_store's `rank_todo.py --check` and todo-item can refuse a list it cannot read: touch_predictions imports plan_store, so plan_store cannot import from touch_predictions. +It sits in plan so that plan_store's `FilePlan.check` and todo-item can call `predicted`: touch_predictions imports plan_store, and importing touch_predictions from plan_store would make the two packages import each other. The spelling, which the decision `todo.md: an item of the next release predicts the files and parts it will touch …` gives the reasons for: @@ -48,7 +48,7 @@ def predicted(detail: str) -> Touches | None | Failure: break read = bullet(line) if read is None: - return Failure(f"the bullet {line!r} under `{LABEL}` is not a path in backticks, then optionally a colon and its parts, each a name in backticks or `lines -`, and optionally `{SMALL}`") + return Failure(f"the bullet {line!r} under `{LABEL}` is not a path in backticks, then optionally a colon and its parts, each a name in backticks or `lines -` that `{SMALL.strip()}` may follow; `{SMALL.strip()}` follows a part, never a bare path") if any(span and span[0] > span[1] for span in map(line_range, read[1])): return Failure(f"the bullet {line!r} under `{LABEL}` holds a line range whose first line comes after its last") touches = together([touches, {read[0]: read[1]}]) diff --git a/todo.md b/todo.md index 270eadbe..32c758b6 100644 --- a/todo.md +++ b/todo.md @@ -6,7 +6,7 @@ `Bar = 0.1` -`Next ID = 425` +`Next ID = 426` ## Items @@ -27,7 +27,7 @@ | 414 | 0.12.0 | 410 | | **DM the human through the notifier when a human-task issue blocks the epic's next item, and poll until it closes.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 417 | 0.12.0 | 410 | | **Run do-epic end to end against a sandbox epic on a real Jira site with a command of its own, outside `run-tests`.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | | 421 | 0.12.0 | | | **Refuse in rule-hook a Bash or Monitor wait that has no end: a loop without a time or count cap, and a `pgrep -f` or `pkill -f` whose pattern the same command line contains.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | -| 424 | 0.12.0 | | | **Refuse a Touches: list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | +| 424 | 0.12.0 | | | **Refuse a `Touches:` list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | | 316 | 0.12.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.0 | | 310 | 0.12.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 | 0.9 | | 422 | 0.12.0 | 401, 420 | | **Check every 5 minutes whether a tmux window of the loop looks stuck by other signs than a lingering worker, investigate it with a headless claude, and kill only the process the investigation names.** | 3 | 2 | 3 | 6 | 5 | 1.5 by 4 | 0.8 | @@ -40,6 +40,7 @@ | 341 | 0.13.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.0 | | 298 | 0.13.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 | 0.9 | | 395 | 0.13.0 | | decision | **Keep each block a save didn't change, with its localId, and the spacing paragraphs beside it as Jira or Confluence holds them.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 4 | 0.8 | +| 425 | 0.13.0 | | | **Show on loop-claude's terminal why it doesn't start a chunk beside the next item, as chunk-preflight prints it.** | 1 | 1 | 2 | 2 | 2 | 1.5 by 2 | 0.7 | | 367 | 0.13.0 | | | **Check that every write to a Jira plan leaves it ranked, as rule-hook's `todo-rank-check` checks `todo.md` today.** | 2 | 2 | 3 | 5 | 3 | 1.6 by 2 | 0.7 | | 423 | 0.13.0 | | | **Skip the judge's model call on a worker's final message that the offline classifier decides is finished.** | 3 | 3 | 3 | 7 | 5 | 1.4 by 2 | 0.4 | | 77 | 0.14.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.1 | @@ -268,11 +269,11 @@ Touches: - `bin/rule_hook/test_rule_hook.py`: `CommandBreaches` (small) - `settings.json` -### 424. Refuse a Touches: list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check. +### 424. Refuse a `Touches:` list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check. -On 2026-11-18 six items (400, 401, 416, 420, 421 and 422) held `Touches:` lists that touch-predictions cannot read, such as ``- `bin/judge_replay/main.py` (small)`` and ``- `README.md`: loop-claude's section (small)``. chunk-preflight reads the lists first, so loop-claude silently started nothing beside item 401, and slots sat idle for over an hour; the same mistake had been fixed by hand on 2026-11-16 (commit 4b508615). Nothing checked a list when it was written. +On 2026-11-18 six items (400, 401, 416, 420, 421 and 422) held `Touches:` lists that touch-predictions cannot read, such as ``- `bin/judge_replay/main.py` (small)`` and ``- `README.md`: loop-claude's section (small)``. loop-claude reads the lists before it starts chunks beside the next item, so it didn't start any chunk beside item 401, and didn't say why; slots sat idle for over an hour. The same mistake had been fixed by hand on 2026-11-16 (commit 4b508615). Nothing checked a list when it was written. -Both checks call `predicted`, so they cannot drift from the reader; its spelling stays as it is. The reader moves from `bin/touch_predictions/prediction.py` to `bin/plan/touches.py`, since touch_predictions imports plan_store and plan_store's check needs the reader. `todo-item add` and `edit --detail` refuse such a detail, writing nothing, in main.py before the plan's backend gets it, so a plan in Jira is held to it too. `rank_todo.py --check` fails on any item in todo.md whose list it cannot read, naming the item and the reason. Moves 1.5 (delivery speed): idle chunk slots are what the mistake cost. +Both checks call `predicted`, touch-predictions' parser, so they cannot drift from it, and the spelling it reads stays as it is. The parser moves from `bin/touch_predictions/prediction.py` to `bin/plan/touches.py`, with its tests, since touch_predictions imports plan_store and plan_store's check needs the parser. `todo-item add` and `edit --detail` refuse such a detail, writing nothing, in main.py before the plan's backend gets it, so a plan in Jira is held to it too. `rank_todo.py --check` fails on any item in todo.md whose list it cannot read, naming the item and the reason. Moves 1.5 (delivery speed): idle chunk slots are what the mistake cost. Touches: @@ -282,7 +283,9 @@ Touches: - `bin/test_rank_todo.py` - `bin/rank_todo.py`: `(module)` (small) - `bin/plan/touches.py` +- `bin/plan/test_touches.py` - `bin/touch_predictions/prediction.py` +- `bin/touch_predictions/test_touch_predictions.py` - `rules/todo-items.md`: `` # Todo items (`todo.md`) `` (small) ### 316. 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. @@ -425,6 +428,10 @@ Touches: Today a Jira detail edited in one line, or a Confluence record with one entry appended, is written back whole by adf-codec's portable pair, which drops each block's localId and the empty paragraphs Jira uses for spacing. A save whose text is the text a read showed already sends nothing (`docs/decisions.md` → `project config: the loop shows a Jira description and a Confluence page as adf-codec's portable markdown, …`). Match the saved markdown's top-level blocks against the held document's, each as the portable pair reads it, and send the held block where they match. The decision's limit on partial saves ends with this item. +### 425. Show on loop-claude's terminal why it doesn't start a chunk beside the next item, as chunk-preflight prints it. + +`chunks_beside` names each item it refuses and why, such as an unreadable `Touches:` list, and chunk-preflight prints those lines, but loop-claude's `chunk_windows.may_start` keeps only `picked` and drops them, so idle slots show no reason. Found by item 424's product-owner review; a list a person edits in Jira's UI, or one filed before item 424, still reaches loop-claude unchecked. + ### 367. Check that every write to a Jira plan leaves it ranked, as rule-hook's `todo-rank-check` checks `todo.md` today. One of 0.13.0's history ports, per lilleman's call of 2026-11-12. From 1559dcd6c987fcf1ea1ebc84d21ea99628008255 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:35:03 +0100 Subject: [PATCH 15/26] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=206=20=F0=9F=9F=A1=20(0=20misread);=20reword=20th?= =?UTF-8?q?e=20help,=20docstrings,=20rule=20and=20item=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/plan_store/todo_md.py | 4 ++-- bin/rank_todo.py | 4 ++-- rules/todo-items.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/plan_store/todo_md.py b/bin/plan_store/todo_md.py index 5c750b22..ebe3cc54 100644 --- a/bin/plan_store/todo_md.py +++ b/bin/plan_store/todo_md.py @@ -85,7 +85,7 @@ class FilePlan: return ranked def check(self) -> list[str]: - """Why `rank_todo.py --check` fails on the file, empty when it passes: the file is not ranked, an item scores under the bar, or an item's `Touches:` list is one touch-predictions cannot read.""" + """Why `rank_todo.py --check` fails on the file, empty when it passes: the file is not ranked, an item scores under the bar, or touch-predictions cannot read an item's `Touches:` list.""" texts = self.texts() if isinstance(texts, Failure): return [texts.reason] @@ -117,7 +117,7 @@ class FilePlan: def unreadable_touches(todo: str) -> list[str]: - """Why touch-predictions cannot read each item's `Touches:` list that it cannot. Every item is read, not only the next release's: a later item moves into the next release with its detail, and the list is fixed most cheaply where it was written.""" + """One line per item whose `Touches:` list touch-predictions cannot read, saying why. Every item is read, not only the next release's: a later item moves into the next release with its detail, and the list is fixed most cheaply where it was written.""" details = item_details(todo) if isinstance(details, Failure): return [details.reason] diff --git a/bin/rank_todo.py b/bin/rank_todo.py index c61c54b6..47ad8c30 100755 --- a/bin/rank_todo.py +++ b/bin/rank_todo.py @@ -12,7 +12,7 @@ then by ID. Then it moves each blocker, an item another's Blocked by cell names, 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 doesn't write anything and fails when the file is not ranked as it would be, or when an item's detail holds a -`Touches:` list that touch-predictions cannot read, as `touch-predictions --help` spells it. +`Touches:` list not spelt as `touch-predictions --help` shows. A valid todo.md; ## Details and each item's detail are optional: @@ -88,7 +88,7 @@ Exit 1, saying why, on bad arguments, a checkout no config names or a config tha file given that is not the config's plan, a file that cannot be read or written, a todo.md, goals file or docs/decisions.md that breaks the rules above, a scoring run on docs/comprehension-history.md's newest scored commit with no Mean row ending in its overall, an item that is not exempt scoring under the bar, or --check finding the file -unranked or a `Touches:` list it cannot read. +unranked, or an item's `Touches:` list unreadable. """ import pathlib import sys diff --git a/rules/todo-items.md b/rules/todo-items.md index fd8e2c8d..4c5eb925 100644 --- a/rules/todo-items.md +++ b/rules/todo-items.md @@ -30,4 +30,4 @@ paths: - **The Exempt cell keeps an item whatever its score:** `security` for a security finding, `defect` for a 🔴 finding or an item that restores a maintain goal the project breaks today, `question` for a question only the human can answer, which ranks first in its release, `decision` for an item `docs/decisions.md` cites, `owner` for an item the human told you to keep, and, where no other reason fits, `principle` for a 🟡 finding against a file in the config's principles folder, whose item's detail names that principle. Every item `docs/decisions.md` cites carries one of these reasons. - **A maintain goal vetoes an item that breaks it,** whatever the item scores: redesign the item so it holds the goal, or drop it. - **When you remove an item that no chunk built, title the commit `Drop item : `,** or `Drop items 12, 14 and 15: ` for several. Such an item was deleted under the bar, vetoed, superseded or moot; a finished item is not one. Without the title, `score-outcomes` credits the item with the work of the chunk that removed it, where that chunk changed more than `todo.md`. -- **Predict, in the detail of each item of the next release, what the item will touch.** When you plan the next release, or file or move an item into it, give the item's detail a `Touches:` line, then one bullet per file the item will change. Each bullet names the file, then the parts of it the item will change: a function, a class or a section heading, or line ranges where the file has none of these. A path alone means the whole file. Read the code first; a prediction from the item's text alone misses. `~/.claude/bin/touch-predictions --help` shows the spelling and how a part is named; a name that holds a backtick takes a longer run of backticks with a space inside each end, as a Markdown code span does. Mark a part `(small)` where the item changes only a few lines of it. `(small)` follows a part, never a bare path, and a part is a name in backticks or `lines -`. BANNED: ``- `bin/a.py` (small)``, ``- `README.md`: loop-claude's section (small)``. GOOD: ``- `bin/a.py`: `main` (small)``, ``- `README.md`: `## Loop` (small)``. `todo-item add`, `todo-item edit` and `rank_todo.py --check` refuse a list touch-predictions cannot read. Leave out the plan and the project's records, which every chunk writes. `chunk-preflight` reads the predictions to name the items that may start chunks at once, and `touch-predictions record` keeps each beside what its chunk touched. +- **Predict, in the detail of each item of the next release, what the item will touch.** When you plan the next release, or file or move an item into it, give the item's detail a `Touches:` line, then one bullet per file the item will change. Each bullet names the file, then the parts of it the item will change: a function, a class or a section heading, or line ranges where the file has none of these. A path alone means the whole file. Read the code first; a prediction from the item's text alone misses. `~/.claude/bin/touch-predictions --help` shows the spelling and how a part is named; a name that holds a backtick takes a longer run of backticks with a space inside each end, as a Markdown code span does. Mark a part `(small)` where the item changes only a few lines of it. `(small)` follows a part, never a bare path. A part is a name in backticks, or `lines -`. BANNED: ``- `bin/a.py` (small)``, ``- `README.md`: loop-claude's section (small)``. GOOD: ``- `bin/a.py`: `main` (small)``, ``- `README.md`: `## Tools` (small)``. Leave out the plan and the project's records, which every chunk writes. `chunk-preflight` reads the predictions to name the items that may start chunks at once, and `touch-predictions record` keeps each beside what its chunk touched. `todo-item add`, `todo-item edit` and `rank_todo.py --check` refuse a list touch-predictions cannot read. From 21a15bcf788bb2d2df5c216a2397f05c2a561ba4 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:37:34 +0100 Subject: [PATCH 16/26] Finish item 424 in the plan --- CHANGELOG.md | 1 + todo.md | 20 -------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b63cea11..a41c6d23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- `todo-item add` and `todo-item edit --detail` refuse a detail whose `Touches:` list touch-predictions cannot read, and `rank_todo.py --check` fails on each item holding one, so rule-hook refuses a commit of such a plan: after updating, run `~/.claude/bin/rank_todo.py --check` in each project and fix each list it names. - loop-claude hands each worker's claude a Bash output ceiling of 6,000 characters that saves a longer result to a file, rule-hook refuses a Read of a session transcript under ~/.claude/projects, and review-replay takes --bash-ceiling and --read-limit to test such a limit against archived review rounds. - do-epic picks each epic item's repo, or that it is Claude's work or a human task, by repo-rule.md and a headless claude call, records the pick as a label on the issue and reads it back without a new call; where the rule leaves it unclear it returns a question for the human. The epic backends gain a label write. - judge-replay --offline replays every archived verdict through a "?" rule, a decision table and a classifier trained on the archive, with no judge call, and counts the interrupts each misses. diff --git a/todo.md b/todo.md index 32c758b6..a1d37ab0 100644 --- a/todo.md +++ b/todo.md @@ -27,7 +27,6 @@ | 414 | 0.12.0 | 410 | | **DM the human through the notifier when a human-task issue blocks the epic's next item, and poll until it closes.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 417 | 0.12.0 | 410 | | **Run do-epic end to end against a sandbox epic on a real Jira site with a command of its own, outside `run-tests`.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | | 421 | 0.12.0 | | | **Refuse in rule-hook a Bash or Monitor wait that has no end: a loop without a time or count cap, and a `pgrep -f` or `pkill -f` whose pattern the same command line contains.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | -| 424 | 0.12.0 | | | **Refuse a `Touches:` list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | | 316 | 0.12.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.0 | | 310 | 0.12.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 | 0.9 | | 422 | 0.12.0 | 401, 420 | | **Check every 5 minutes whether a tmux window of the loop looks stuck by other signs than a lingering worker, investigate it with a headless claude, and kill only the process the investigation names.** | 3 | 2 | 3 | 6 | 5 | 1.5 by 4 | 0.8 | @@ -269,25 +268,6 @@ Touches: - `bin/rule_hook/test_rule_hook.py`: `CommandBreaches` (small) - `settings.json` -### 424. Refuse a `Touches:` list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check. - -On 2026-11-18 six items (400, 401, 416, 420, 421 and 422) held `Touches:` lists that touch-predictions cannot read, such as ``- `bin/judge_replay/main.py` (small)`` and ``- `README.md`: loop-claude's section (small)``. loop-claude reads the lists before it starts chunks beside the next item, so it didn't start any chunk beside item 401, and didn't say why; slots sat idle for over an hour. The same mistake had been fixed by hand on 2026-11-16 (commit 4b508615). Nothing checked a list when it was written. - -Both checks call `predicted`, touch-predictions' parser, so they cannot drift from it, and the spelling it reads stays as it is. The parser moves from `bin/touch_predictions/prediction.py` to `bin/plan/touches.py`, with its tests, since touch_predictions imports plan_store and plan_store's check needs the parser. `todo-item add` and `edit --detail` refuse such a detail, writing nothing, in main.py before the plan's backend gets it, so a plan in Jira is held to it too. `rank_todo.py --check` fails on any item in todo.md whose list it cannot read, naming the item and the reason. Moves 1.5 (delivery speed): idle chunk slots are what the mistake cost. - -Touches: - -- `bin/todo_item/main.py`: `main` (small), `edit` (small) -- `bin/todo_item/test_todo_item.py` -- `bin/plan_store/todo_md.py`: `FilePlan.check` -- `bin/test_rank_todo.py` -- `bin/rank_todo.py`: `(module)` (small) -- `bin/plan/touches.py` -- `bin/plan/test_touches.py` -- `bin/touch_predictions/prediction.py` -- `bin/touch_predictions/test_touch_predictions.py` -- `rules/todo-items.md`: `` # Todo items (`todo.md`) `` (small) - ### 316. 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. Seats run as general-purpose subagents, so each starts with the skill and agent listings, about 7,500 tokens, at $9.00 per 1,000 prefix tokens over the archive measured from 2026-09-30 to 2026-11-11: about 1.3% of spend. An agent under `agents/` with Read, Grep, Glob and Bash, `omitClaudeMd: true`, and the seat's persona in its prompt drops both; a seat reads the project as a newcomer does, which is what it simulates. Keep each seat's prompt from `skills/comprehension-panel/seat-prompts.md`. Check that a scoring run's scores on one head stay within the spread two runs of today's seats show. lilleman approved on 2026-11-11. From 5088b9e1750ca63ed4ae758419bee3c3e6469463 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:45:56 +0100 Subject: [PATCH 17/26] Sort the scorer's imports and end its message as a citation reads --- bin/do_epic/ranking.py | 10 +++++----- bin/do_epic/test_ranking.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/do_epic/ranking.py b/bin/do_epic/ranking.py index 055a7a2b..99c37bb5 100644 --- a/bin/do_epic/ranking.py +++ b/bin/do_epic/ranking.py @@ -7,15 +7,15 @@ import ast import dataclasses import decimal -from failure import Failure -from plan import ranking from plan.blockers import blockers_first -from plan.formula import parse_formula -from plan.goals_file import goal_weights, Mark, numbered, ranked_goals from plan.todo_table import CODE_HEALTH, EPIC_GOAL, Item, REPO_GOAL, SHAPE +from failure import Failure +from plan.goals_file import goal_weights, Mark, numbered, ranked_goals from review_rules.comprehension_history import latest_overall +from plan.formula import parse_formula +from plan import ranking -MARK_IT = "is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says" +MARK_IT = "is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says, so the epic's items can be scored" @dataclasses.dataclass(frozen=True) diff --git a/bin/do_epic/test_ranking.py b/bin/do_epic/test_ranking.py index 93ee16f0..19d4a268 100644 --- a/bin/do_epic/test_ranking.py +++ b/bin/do_epic/test_ranking.py @@ -91,9 +91,9 @@ class RankedTest(unittest.TestCase): def test_a_goal_marked_neither_way_fails_naming_whose_it_is(self) -> None: unmarked = RepoPremises("## Goals\n\n1. Fast builds.\n", "", "", decimal.Decimal("7.0")) - self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": unmarked}), Failure("billing-api's goal 1 is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says")) + self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": unmarked}), Failure("billing-api's goal 1 is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says, so the epic's items can be scored")) found = ranked([item(4, "epic 1 by 5", repo=None)], "V", "1. Ship invoices.\n", {}) - self.assertEqual(found, Failure("the epic's goal 1 is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says")) + self.assertEqual(found, Failure("the epic's goal 1 is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says, so the epic's items can be scored")) def test_a_repos_goals_file_that_cannot_be_read_fails_naming_the_repo(self) -> None: self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": RepoPremises("# Billing\n", "", "", decimal.Decimal("7.0"))}), Failure("billing-api: the goals file has no ## Goals heading")) From c63c3b3467d32bcaa6ac2eeff7879c22f985a5c7 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:46:23 +0100 Subject: [PATCH 18/26] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From e6b9de55ccab6cea2f58fd2165d199b17753e9e4 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:51:37 +0100 Subject: [PATCH 19/26] =?UTF-8?q?Answer=20stability=20round=201:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20weigh=20the?= =?UTF-8?q?=20epic's=20achieve=20goals=20the=20same=20in=20every=20repo's?= =?UTF-8?q?=20chain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/do_epic/ranking.py | 77 ++++++++++++++++++++++++------------- bin/do_epic/test_ranking.py | 52 +++++++++++++++++-------- bin/plan/todo_table.py | 2 +- todo.md | 2 +- 4 files changed, 88 insertions(+), 45 deletions(-) diff --git a/bin/do_epic/ranking.py b/bin/do_epic/ranking.py index 99c37bb5..1aff8aed 100644 --- a/bin/do_epic/ranking.py +++ b/bin/do_epic/ranking.py @@ -1,8 +1,8 @@ """The order do-epic works an epic's items in: by score, then each blocker above what it blocks (docs/decisions.md → `do-epic: drives one Jira epic …`). -An item scores by the epic's formula over one chain of goals: the epic's goals, then code health, then the goals of the item's repo. plan/goals_file.py's goal_weights weighs the chain as it weighs one project's goals, so a goal of the epic outweighs every goal of a repo. An item without a repo has only the epic's goals. +An item scores by the epic's formula over one chain of goals: the epic's goals, then code health, then the goals of the item's repo. An item without a repo has only the epic's goals. Each achieve goal weighs 0.97 of the one above it in the chain, and the epic's achieve goals weigh the same in every repo, so an achieve goal of the epic outweighs every achieve goal of a repo, whichever repos the two items are in. chain_scoring says what code health and a maintain goal weigh. -The epic and each repo number their goals from 1, so an item's Moves names a goal by its scope: `epic 1.1 by 8, code health by 5, repo 2 by 4`.""" +An item's Moves names a goal by its scope, as plan/todo_table.py's EPIC_GOAL says.""" import ast import dataclasses import decimal @@ -10,17 +10,18 @@ import decimal from plan.blockers import blockers_first from plan.todo_table import CODE_HEALTH, EPIC_GOAL, Item, REPO_GOAL, SHAPE from failure import Failure -from plan.goals_file import goal_weights, Mark, numbered, ranked_goals +from plan.goals_file import goal_weights, GOAL_STEP, Mark, numbered, ranked_goals from review_rules.comprehension_history import latest_overall from plan.formula import parse_formula from plan import ranking +from plan_store.jira_epic import SET_SCORES MARK_IT = "is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says, so the epic's items can be scored" @dataclasses.dataclass(frozen=True) -class RepoPremises: - """What a repo's own plan is ranked by: its goals file, its decision log and comprehension history, each as text, and its readability floor.""" +class RepoRanking: + """What a repo's own plan is ranked by: its goals file, its decision log and its comprehension history, each as text, and its readability floor.""" goals_text: str decisions: str history: str @@ -29,13 +30,13 @@ class RepoPremises: @dataclasses.dataclass(frozen=True) class EpicItem: - """One of an epic's open items. An epic item has no release, so every item of one epic holds the same one. repo is the name of the repo it is worked in; None where it has none.""" + """One of an epic's open items. An Item names a release and an epic item has none: give every item of one epic the same release, so that no blocker sits in a later release than what it blocks. repo is the name of the repo the item is worked in; None where it has none.""" item: Item repo: str | None -def ranked(items: list[EpicItem], formula: str, epic_goals: str, repos: dict[str, RepoPremises]) -> list[tuple[Item, float]] | Failure: - """Each item with its score: a question first, then a security finding, then by score from highest, then by ID, and then each blocker above every item it blocks. formula is the epic's, epic_goals the text under its ## Goals, and repos the premises of each repo an item is in, by name.""" +def ranked(items: list[EpicItem], formula: str, epic_goals: str, repos: dict[str, RepoRanking]) -> list[tuple[Item, float]] | Failure: + """Each item with its score: a question first, then a security finding, then by score from highest, then by ID, and then each blocker above every item it blocks. formula is the epic's, epic_goals the text under its ## Goals, and repos holds, by name, each repo an item is in. An item without a score fails, so leave out an issue a person filed and nobody scored.""" parsed = parse_formula(formula, ranking.variables(SHAPE)) if isinstance(parsed, Failure): return parsed @@ -50,7 +51,7 @@ def ranked(items: list[EpicItem], formula: str, epic_goals: str, repos: dict[str if isinstance(scoring, Failure): return scoring scorings[each.repo] = scoring - value = unnamed_goal(each, scorings[each.repo], name) or ranking.item_score(each.item, scorings[each.repo], name) + value = unscored(each.item, name) or misnamed_goal(each, scorings[each.repo], name) or ranking.item_score(each.item, scorings[each.repo], name) if isinstance(value, Failure): return value scored.append((each.item, value)) @@ -58,48 +59,70 @@ def ranked(items: list[EpicItem], formula: str, epic_goals: str, repos: dict[str return blockers_first(scored) -def chain_scoring(formula: ast.Expression, epic_goals: str, repo: str | None, premises: RepoPremises | None) -> ranking.Scoring | Failure: - """How an item in repo scores: the chain's goals, each achieve goal at its weight. The bar is 0, since the bar decides what is filed, not the order of what was.""" - goals = chain(epic_goals, repo, premises) +def chain_scoring(formula: ast.Expression, epic_goals: str, repo: str | None, own: RepoRanking | None) -> ranking.Scoring | Failure: + """How an item in repo scores: the chain's goals, and what each achieve goal weighs. The bar is 0, since a bar decides what is filed, and the order holds every item that was. + + goal_weights scales a chain's weights to sum to 1. Here they are scaled so that the epic's achieve goals sum to 1 instead, in every chain, which makes the scores of items in different repos comparable. + + Code health and a maintain goal weigh by the rules every project's plan follows, which an epic doesn't change: code health weighs four times its place while its repo is unmeasured or under its readability floor, and plan/ranking.py's weight_of weighs a maintain goal. Either may then outweigh an achieve goal of the epic. "The epic wins" in the decision settles the epic's goals against a repo's, and code health is neither's: it is every project's, and a repo that is hard to read costs each epic item worked in it.""" + goals = chain(epic_goals, repo, own) if isinstance(goals, Failure): return goals if unmarked := next((goal for goal, mark in goals if mark is None), None): whose, _, number = unmarked.partition(" ") return Failure(f"{'the epic' if whose == 'epic' else repo}'s goal {number} {MARK_IT}") - overall = latest_overall(premises.history) if premises and CODE_HEALTH in dict(goals) else None + overall = latest_overall(own.history) if own and CODE_HEALTH in dict(goals) else None if isinstance(overall, Failure): return Failure(f"{repo}: {overall.reason}") - # goal_weights fails only on a goal without a mark, which the check above already named by whose it is. - weights = goal_weights(goals, overall, premises.floor if premises else decimal.Decimal(0)) - return weights if isinstance(weights, Failure) else ranking.Scoring(SHAPE, formula, 0, 0, dict(goals), weights) + # goal_weights fails only on a goal without a mark, and the check above has named that goal as the epic's or the repo's. + weights = goal_weights(goals, overall, own.floor if own else decimal.Decimal(0)) + if isinstance(weights, Failure): + return weights + achieve = [goal for goal, mark in goals if mark == "Achieve"] + of_epic = len([goal for goal in achieve if goal.startswith(EPIC_GOAL)]) + # An epic without an achieve goal leaves each chain summing to 1. + scale = total(len(achieve)) / total(of_epic) if of_epic else 1 + return ranking.Scoring(SHAPE, formula, 0, 0, dict(goals), {goal: weight * scale for goal, weight in weights.items()}) -def chain(epic_goals: str, repo: str | None, premises: RepoPremises | None) -> list[tuple[str, Mark]] | Failure: - """Every goal an item may name, in rank order, each with its mark: the epic's goals as `epic `, then, for an item in repo, which has these premises, code health unless the repo's goals file voids it, and the repo's goals as `repo `.""" +def total(goals: int) -> float: + """What this many achieve goals weigh together before goal_weights scales them, the first 1 and each 0.97 of the one above it.""" + return sum(GOAL_STEP**place for place in range(goals)) + + +def chain(epic_goals: str, repo: str | None, own: RepoRanking | None) -> list[tuple[str, Mark]] | Failure: + """Every goal an item in repo may name, in rank order, each with its mark. The epic's goals come first, as `epic `. For an item with a repo, whose ranking is own, code health follows unless the repo's goals file voids it, then the repo's goals as `repo `.""" epic = numbered(epic_goals) if isinstance(epic, Failure): return Failure(epic.reason.replace("the goals file's", "the epic's")) scoped = [(f"{EPIC_GOAL}{number}", mark) for number, mark in epic] - if premises is None: + if own is None: return scoped - own = ranked_goals(premises.goals_text, premises.decisions) - if isinstance(own, Failure): - return Failure(f"{repo}: {own.reason}") - return [*scoped, *((goal if goal == CODE_HEALTH else f"{REPO_GOAL}{goal}", mark) for goal, mark in own)] + goals = ranked_goals(own.goals_text, own.decisions) + if isinstance(goals, Failure): + return Failure(f"{repo}: {goals.reason}") + return [*scoped, *((goal if goal == CODE_HEALTH else f"{REPO_GOAL}{goal}", mark) for goal, mark in goals)] -def unnamed_goal(each: EpicItem, scoring: ranking.Scoring, name: str) -> Failure | None: +def unscored(item: Item, name: str) -> Failure | None: + """Why the item cannot be scored, such as an issue a person filed and nobody scored; None where it holds each score.""" + missing = next((score for score in SET_SCORES if score not in item.scores), None) + return Failure(f"{name} has no {missing}: score it on {', '.join(SET_SCORES[:-1])} and {SET_SCORES[-1]} before it is ranked") if missing else None + + +def misnamed_goal(each: EpicItem, scoring: ranking.Scoring, name: str) -> Failure | None: """Why the item may not name one of the goals it names, in the epic's terms; None where its chain holds each.""" for goal, _ in each.item.moves: if goal in scoring.goals: continue - if not goal.startswith((EPIC_GOAL, REPO_GOAL)) and goal != CODE_HEALTH: - return Failure(f"{name} names goal {goal} without saying whose it is; write `{EPIC_GOAL}{goal}` for the epic's goal or `{REPO_GOAL}{goal}` for its repo's") if goal.startswith(EPIC_GOAL): return Failure(f"{name} names {goal}, which the epic's ## Goals does not number") if each.repo is None: - return Failure(f"{name} names {goal}, but has no repo whose {'code' if goal == CODE_HEALTH else 'goal'} that could be; name only the epic's goals, as in `{EPIC_GOAL}1 by 5`") + scoped = f"; write `{EPIC_GOAL}{goal}` for the epic's goal" if goal[0].isdigit() else f"; name only the epic's goals, as in `{EPIC_GOAL}1 by 5`" + return Failure(f"{name} names {goal}, but isn't worked in a repo{scoped}") if goal == CODE_HEALTH: return Failure(f"{name} names {CODE_HEALTH}, which {each.repo}'s goals file voids") + if not goal.startswith(REPO_GOAL): + return Failure(f"{name} names goal {goal} without saying whose it is; write `{EPIC_GOAL}{goal}` for the epic's goal or `{REPO_GOAL}{goal}` for its repo's") return Failure(f"{name} names {goal}, which the ## Goals of {each.repo}'s goals file does not number") return None diff --git a/bin/do_epic/test_ranking.py b/bin/do_epic/test_ranking.py index 19d4a268..06d928b0 100644 --- a/bin/do_epic/test_ranking.py +++ b/bin/do_epic/test_ranking.py @@ -6,17 +6,17 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from do_epic.ranking import chain, EpicItem, ranked, RepoPremises +from do_epic.ranking import chain, EpicItem, ranked, RepoRanking from failure import Failure from plan.todo_table import Item, parse_moves EPIC_GOALS = "1. **Achieve:** Ship invoices.\n2. **Achieve:** Cut support mail.\n3. **Maintain:** Leak no customer data.\n" -VOIDED = RepoPremises("## Goals\n\n**Void:** code health, since it is a one-off script.\n\n1. **Achieve:** Fast builds.\n", "", "", decimal.Decimal("7.0")) -HEALTHY = RepoPremises("## Goals\n\n1. **Achieve:** Fast builds.\n2. **Maintain:** Stay on the LTS.\n", "", "", decimal.Decimal("7.0")) +VOIDED = RepoRanking("## Goals\n\n**Void:** code health, since it is a one-off script.\n\n1. **Achieve:** Fast builds.\n", "", "", decimal.Decimal("7.0")) +HEALTHY = RepoRanking("## Goals\n\n1. **Achieve:** Fast builds.\n2. **Maintain:** Stay on the LTS.\n", "", "", decimal.Decimal("7.0")) # A scoring run of a repo whose overall mean is {overall}. SCORED = "# Comprehension history\n\n## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\n| Seat | Overall |\n|---|---|\n| Mid A | 6 |\n| Mean | {overall} |\n" -# What the three achieve goals of the chain epic 1, epic 2, repo 1 weigh together before they are scaled to sum to 1, each 0.97 of the one above. -TOTAL = 1 + 0.97 + 0.97**2 +# What the epic's two achieve goals weigh together before they are scaled to sum to 1, the second 0.97 of the first. +TOTAL = 1 + 0.97 def item(id_: int, moves: str, repo: str | None = "billing-api", exempt: str = "", blocked_by: tuple[int, ...] = ()) -> EpicItem: @@ -25,7 +25,7 @@ def item(id_: int, moves: str, repo: str | None = "billing-api", exempt: str = " return EpicItem(Item(id_, (0, 0, 0), exempt, f"**Item {id_}.**", {"L": 1, "E": 1, "I": 1, "S": 1}, parsed, blocked_by), repo) # type: ignore[arg-type] -def order(items: list[EpicItem], repos: dict[str, RepoPremises], formula: str = "V") -> list[int] | Failure: +def order(items: list[EpicItem], repos: dict[str, RepoRanking], formula: str = "V") -> list[int] | Failure: found = ranked(items, formula, EPIC_GOALS, repos) return found if isinstance(found, Failure) else [scored.id for scored, _ in found] @@ -72,15 +72,36 @@ class RankedTest(unittest.TestCase): def test_an_item_without_a_repo_scores_by_the_epics_goals_alone(self) -> None: found = ranked([item(1, "epic 1 by 10", repo=None)], "V", EPIC_GOALS, {}) assert not isinstance(found, Failure), found - self.assertAlmostEqual(found[0][1], 10 / 1.97) + self.assertAlmostEqual(found[0][1], 10 / TOTAL) def test_an_item_without_a_repo_may_not_name_a_repos_goal_or_code_health(self) -> None: - self.assertEqual(order([item(4, "repo 1 by 5", repo=None)], {}), Failure("item 4 names repo 1, but has no repo whose goal that could be; name only the epic's goals, as in `epic 1 by 5`")) - self.assertEqual(order([item(4, "code health by 5", repo=None)], {}), Failure("item 4 names code health, but has no repo whose code that could be; name only the epic's goals, as in `epic 1 by 5`")) + self.assertEqual(order([item(4, "repo 1 by 5", repo=None)], {}), Failure("item 4 names repo 1, but isn't worked in a repo; name only the epic's goals, as in `epic 1 by 5`")) + self.assertEqual(order([item(4, "code health by 5", repo=None)], {}), Failure("item 4 names code health, but isn't worked in a repo; name only the epic's goals, as in `epic 1 by 5`")) + self.assertEqual(order([item(4, "2 by 5", repo=None)], {}), Failure("item 4 names 2, but isn't worked in a repo; write `epic 2` for the epic's goal")) def test_a_goal_without_its_scope_is_refused(self) -> None: self.assertEqual(order([item(4, "1 by 5")], {"billing-api": VOIDED}), Failure("item 4 names goal 1 without saying whose it is; write `epic 1` for the epic's goal or `repo 1` for its repo's")) + def test_an_epics_goal_outweighs_a_repos_goal_across_repos_with_chains_of_different_lengths(self) -> None: + long = RepoRanking("## Goals\n\n" + "".join(f"{place}. **Achieve:** Goal {place}.\n" for place in range(1, 10)), "", "", decimal.Decimal("7.0")) + found = ranked([item(1, "repo 1 by 10"), item(2, "epic 2 by 10", repo="web"), item(3, "epic 2 by 10", repo=None)], "V", EPIC_GOALS, {"billing-api": VOIDED, "web": long}) + assert not isinstance(found, Failure), found + self.assertEqual([scored.id for scored, _ in found], [2, 3, 1]) + for (_, value), expected in zip(found, (9.7 / TOTAL, 9.7 / TOTAL, 10 * 0.97**2 / TOTAL)): + self.assertAlmostEqual(value, expected) + + def test_an_epic_without_an_achieve_goal_leaves_each_repos_weights_summing_to_1(self) -> None: + found = ranked([item(1, "repo 1 by 10")], "V", "1. **Maintain:** Leak no customer data.\n", {"billing-api": VOIDED}) + assert not isinstance(found, Failure), found + self.assertAlmostEqual(found[0][1], 10) + + def test_an_item_without_a_score_fails_naming_it(self) -> None: + unscored = EpicItem(dataclasses.replace(item(4, "").item, scores={}), None) + self.assertEqual(ranked([unscored], "V", EPIC_GOALS, {}), Failure("item 4 has no L: score it on L, E, I and S before it is ranked")) + + def test_an_epic_that_numbers_a_goal_twice_fails(self) -> None: + self.assertEqual(chain("1. **Achieve:** A.\n1. **Achieve:** B.\n", None, None), Failure("the epic's ## Goals numbers 1, 1; number each goal by its position")) + def test_a_goal_the_chain_does_not_hold_is_refused(self) -> None: self.assertEqual(order([item(4, "epic 9 by 5")], {"billing-api": VOIDED}), Failure("item 4 names epic 9, which the epic's ## Goals does not number")) self.assertEqual(order([item(4, "repo 9 by 5")], {"billing-api": VOIDED}), Failure("item 4 names repo 9, which the ## Goals of billing-api's goals file does not number")) @@ -90,27 +111,26 @@ class RankedTest(unittest.TestCase): self.assertEqual(order([item(4, "epic 1 by 5", repo="ghost")], {}), Failure("item 4 is in the repo ghost, whose goals were not read")) def test_a_goal_marked_neither_way_fails_naming_whose_it_is(self) -> None: - unmarked = RepoPremises("## Goals\n\n1. Fast builds.\n", "", "", decimal.Decimal("7.0")) + unmarked = RepoRanking("## Goals\n\n1. Fast builds.\n", "", "", decimal.Decimal("7.0")) self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": unmarked}), Failure("billing-api's goal 1 is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says, so the epic's items can be scored")) found = ranked([item(4, "epic 1 by 5", repo=None)], "V", "1. Ship invoices.\n", {}) self.assertEqual(found, Failure("the epic's goal 1 is marked neither **Maintain:** nor **Achieve:**; mark it, as ~/.claude/rules/goals-and-audience.md says, so the epic's items can be scored")) def test_a_repos_goals_file_that_cannot_be_read_fails_naming_the_repo(self) -> None: - self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": RepoPremises("# Billing\n", "", "", decimal.Decimal("7.0"))}), Failure("billing-api: the goals file has no ## Goals heading")) + self.assertEqual(order([item(4, "epic 1 by 5")], {"billing-api": RepoRanking("# Billing\n", "", "", decimal.Decimal("7.0"))}), Failure("billing-api: the goals file has no ## Goals heading")) def test_code_health_weighs_four_times_its_place_while_the_repo_is_unmeasured_or_under_its_floor(self) -> None: - total = 1 + 0.97 + 0.97**2 + 0.97**3 for history, times in (("", 4), (SCORED.format(overall="6.9"), 4), (SCORED.format(overall="7.0"), 1)): with self.subTest(history=history): found = ranked([item(1, "code health by 10", repo="web"), item(2, "repo 1 by 10", repo="web")], "V", EPIC_GOALS, {"web": dataclasses.replace(HEALTHY, history=history)}) assert not isinstance(found, Failure), found - self.assertAlmostEqual(found[0][1], times * 10 * 0.97**2 / total) - self.assertAlmostEqual(found[1][1], 10 * 0.97**3 / total) + self.assertAlmostEqual(found[0][1], times * 10 * 0.97**2 / TOTAL) + self.assertAlmostEqual(found[1][1], 10 * 0.97**3 / TOTAL) - def test_a_repo_under_its_own_floor_weighs_code_health_by_that_floor(self) -> None: + def test_code_health_weighs_four_times_its_place_under_a_floor_the_repo_sets_higher(self) -> None: found = ranked([item(1, "code health by 10", repo="web")], "V", EPIC_GOALS, {"web": dataclasses.replace(HEALTHY, history=SCORED.format(overall="7.5"), floor=decimal.Decimal("8.0"))}) assert not isinstance(found, Failure), found - self.assertAlmostEqual(found[0][1], 4 * 10 * 0.97**2 / (1 + 0.97 + 0.97**2 + 0.97**3)) + self.assertAlmostEqual(found[0][1], 4 * 10 * 0.97**2 / TOTAL) def test_a_history_that_cannot_be_read_fails_naming_the_repo(self) -> None: found = order([item(1, "code health by 10", repo="web")], {"web": dataclasses.replace(HEALTHY, history=SCORED.format(overall="high"))}) diff --git a/bin/plan/todo_table.py b/bin/plan/todo_table.py index 935b5ea8..f6df5018 100644 --- a/bin/plan/todo_table.py +++ b/bin/plan/todo_table.py @@ -22,7 +22,7 @@ BLOCKED_BY = "Blocked by" MOVES = "Moves" # The achieve goal every project shares, which ~/.claude/CLAUDE.md → "Shared goal" states, and a Moves cell names by these words, since it has no number in any goals file. CODE_HEALTH = "code health" -# What opens a goal's name in the Moves of an epic's item, whose epic and repo both number their goals from 1: `epic 1.1 by 8, code health by 5, repo 2 by 4`. Three readers, seated as the human who reads and writes these cells, picked a scope word on both over one on either alone and over the repo's name, 3-0. do_epic/ranking.py holds the goals such an item may name; a todo.md's item may name neither. +# The scope that opens a goal's name in the Moves of an epic's item, since the epic and the item's repo both number their goals from 1: `epic 1.1 by 8, code health by 5, repo 2 by 4`. Three readers, seated as the human who writes these cells, picked a scope word on both goals, 3-0, over one on either alone and over the repo's name. A todo.md's item may name neither. EPIC_GOAL = "epic " REPO_GOAL = "repo " # How the items table's header opens, which tells it from any other table in todo.md. diff --git a/todo.md b/todo.md index 3d2f2276..522da254 100644 --- a/todo.md +++ b/todo.md @@ -97,7 +97,7 @@ Touches: ### 408. Score an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, and order them by score, then by Blocked by. -Where the epic and a repo disagree, the epic wins (`docs/decisions.md` → `do-epic: drives one Jira epic …`). An item without a repo weighs only the epic's goals. Build the chain as one list for `goal_weights`, score with `ranking.item_score` and order with `blockers_first`. `plan/ranking.py` `score` is a place the seats found hard, so the combiner must not add a branch to it. +Where the epic and a repo disagree, the epic wins (`docs/decisions.md` → `do-epic: drives one Jira epic …`). An item without a repo weighs only the epic's goals. Build the chain as one list for `goal_weights`, score with `ranking.item_score` and order with `blockers_first`. `plan/ranking.py` `score` is a place the seats found hard, so the scorer must not add a branch to it. The epic's and a repo's goal numbers collide, so a Moves cell needs a spelling for a repo's goal beside the epic's; a panel of readers picks it before it ships (`~/.claude/CLAUDE.md` → "Working loop"). The scorer takes the items and each repo's goals as values; item 424 reads them from the tracker, and item 425 re-ranks Jira by the order. From 763b5e56eb1aad9627f908e1926281bac59d6921 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:53:09 +0100 Subject: [PATCH 20/26] Sort the goals imports --- bin/do_epic/ranking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/do_epic/ranking.py b/bin/do_epic/ranking.py index 1aff8aed..80cf27fa 100644 --- a/bin/do_epic/ranking.py +++ b/bin/do_epic/ranking.py @@ -10,7 +10,7 @@ import decimal from plan.blockers import blockers_first from plan.todo_table import CODE_HEALTH, EPIC_GOAL, Item, REPO_GOAL, SHAPE from failure import Failure -from plan.goals_file import goal_weights, GOAL_STEP, Mark, numbered, ranked_goals +from plan.goals_file import GOAL_STEP, goal_weights, Mark, numbered, ranked_goals from review_rules.comprehension_history import latest_overall from plan.formula import parse_formula from plan import ranking From ad42f02af0a5d3cbeef1c7e91e897b33943d9fcc Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:54:44 +0100 Subject: [PATCH 21/26] =?UTF-8?q?Answer=20product-owner=20round=201:=201?= =?UTF-8?q?=20=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(1=20misread);=20fail=20o?= =?UTF-8?q?n=20an=20unscored=20item=20by=20name,=20offer=20a=20repoless=20?= =?UTF-8?q?item=20only=20the=20epic's=20goals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 74766df97a280272a9c66bc37455bbf430223737 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:54:44 +0100 Subject: [PATCH 22/26] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=206=20=F0=9F=9F=A1=20(0=20misread);=20reword=20th?= =?UTF-8?q?e=20docstrings,=20messages=20and=20comment,=20rename=20RepoRank?= =?UTF-8?q?ing=20and=20misnamed=5Fgoal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From a9074901ca623a13a2bf318932350a3c786a7d37 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:03:26 +0100 Subject: [PATCH 23/26] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20weigh=20eac?= =?UTF-8?q?h=20chain's=20first=20achieve=20goal=201=20under=20an=20epic=20?= =?UTF-8?q?without=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/do_epic/ranking.py | 6 +++--- bin/do_epic/test_ranking.py | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/do_epic/ranking.py b/bin/do_epic/ranking.py index 80cf27fa..6625868e 100644 --- a/bin/do_epic/ranking.py +++ b/bin/do_epic/ranking.py @@ -62,7 +62,7 @@ def ranked(items: list[EpicItem], formula: str, epic_goals: str, repos: dict[str def chain_scoring(formula: ast.Expression, epic_goals: str, repo: str | None, own: RepoRanking | None) -> ranking.Scoring | Failure: """How an item in repo scores: the chain's goals, and what each achieve goal weighs. The bar is 0, since a bar decides what is filed, and the order holds every item that was. - goal_weights scales a chain's weights to sum to 1. Here they are scaled so that the epic's achieve goals sum to 1 instead, in every chain, which makes the scores of items in different repos comparable. + goal_weights scales a chain's weights to sum to 1. Here they are scaled so that the epic's achieve goals sum to 1 instead, in every chain, or the chain's first achieve goal weighs 1 where the epic has none, which makes the scores of items in different repos comparable. Code health and a maintain goal weigh by the rules every project's plan follows, which an epic doesn't change: code health weighs four times its place while its repo is unmeasured or under its readability floor, and plan/ranking.py's weight_of weighs a maintain goal. Either may then outweigh an achieve goal of the epic. "The epic wins" in the decision settles the epic's goals against a repo's, and code health is neither's: it is every project's, and a repo that is hard to read costs each epic item worked in it.""" goals = chain(epic_goals, repo, own) @@ -80,8 +80,8 @@ def chain_scoring(formula: ast.Expression, epic_goals: str, repo: str | None, ow return weights achieve = [goal for goal, mark in goals if mark == "Achieve"] of_epic = len([goal for goal in achieve if goal.startswith(EPIC_GOAL)]) - # An epic without an achieve goal leaves each chain summing to 1. - scale = total(len(achieve)) / total(of_epic) if of_epic else 1 + # Under an epic without an achieve goal, the first achieve goal of each chain weighs 1. + scale = total(len(achieve)) / (total(of_epic) or 1) return ranking.Scoring(SHAPE, formula, 0, 0, dict(goals), {goal: weight * scale for goal, weight in weights.items()}) diff --git a/bin/do_epic/test_ranking.py b/bin/do_epic/test_ranking.py index 06d928b0..f6ab1c08 100644 --- a/bin/do_epic/test_ranking.py +++ b/bin/do_epic/test_ranking.py @@ -90,10 +90,12 @@ class RankedTest(unittest.TestCase): for (_, value), expected in zip(found, (9.7 / TOTAL, 9.7 / TOTAL, 10 * 0.97**2 / TOTAL)): self.assertAlmostEqual(value, expected) - def test_an_epic_without_an_achieve_goal_leaves_each_repos_weights_summing_to_1(self) -> None: - found = ranked([item(1, "repo 1 by 10")], "V", "1. **Maintain:** Leak no customer data.\n", {"billing-api": VOIDED}) + def test_an_epic_without_an_achieve_goal_weighs_each_repos_first_achieve_goal_1(self) -> None: + two = dataclasses.replace(VOIDED, goals_text=VOIDED.goals_text + "2. **Achieve:** Small images.\n") + found = ranked([item(1, "repo 1 by 10"), item(2, "repo 1 by 10", repo="web"), item(3, "repo 2 by 10", repo="web")], "V", "1. **Maintain:** Leak no customer data.\n", {"billing-api": VOIDED, "web": two}) assert not isinstance(found, Failure), found - self.assertAlmostEqual(found[0][1], 10) + for (_, value), expected in zip(found, (10, 10, 9.7)): + self.assertAlmostEqual(value, expected) def test_an_item_without_a_score_fails_naming_it(self) -> None: unscored = EpicItem(dataclasses.replace(item(4, "").item, scores={}), None) From 61b77d8937ae5db09e9c8bbf306ca1ca35eccb0d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:03:26 +0100 Subject: [PATCH 24/26] =?UTF-8?q?Answer=20product-owner=20round=202:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20fin?= =?UTF-8?q?ding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 251ca067d579bf64cc4005e8098c2864e532f338 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:05:16 +0100 Subject: [PATCH 25/26] Renumber the two items filed here to 426 and 427, since main took 424 and 425 --- todo.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/todo.md b/todo.md index 99b8b7c5..93e8506a 100644 --- a/todo.md +++ b/todo.md @@ -6,17 +6,17 @@ `Bar = 0.1` -`Next ID = 426` +`Next ID = 428` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 424 | 0.12.0 | | | **Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | +| 426 | 0.12.0 | | | **Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 408 | 0.12.0 | | | **Score an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, and order them by score, then by Blocked by.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | -| 425 | 0.12.0 | 408, 424 | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | +| 427 | 0.12.0 | 408, 426 | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | | 401 | 0.12.0 | | | **Move loop-claude's cycle, judge, interrupt, tmux and routing into a package a second entry point drives, with loop-claude's behaviour unchanged.** | 3 | 2 | 3 | 6 | 6 | 1 by 3, code health by 2 | 1.8 | -| 410 | 0.12.0 | 401, 408, 425 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | +| 410 | 0.12.0 | 401, 408, 427 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | | 416 | 0.12.0 | 410 | | **Finish an epic's repo item with a bullet under its repo's `CHANGELOG.md` → `## Unreleased`, or with none where the repo's plan is in Jira.** | 1 | 1 | 1 | 1 | 2 | 1 by 5 | 2.1 | | 413 | 0.12.0 | 410 | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | | 415 | 0.12.0 | 410, 413 | | **Finish an epic: run release-review passes on each repo it changed, work what they file, have the human confirm each goal, post a summary comment, and close the epic in Jira last.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | @@ -84,9 +84,9 @@ ## Details -### 424. Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends. +### 426. Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends. -Today `EpicIssue` holds none of the three, so do-epic cannot score or order an epic's items (item 408) or tell a person's issue from its own (item 425). The Jira backend reads them as `plan_store/jira_epic.py` does: the `plan-item` issue property, its `Filed by` key, and the "is blocked by" links. The contract tests in `contract.py` cover both backends. +Today `EpicIssue` holds none of the three, so do-epic cannot score or order an epic's items (item 408) or tell a person's issue from its own (item 427). The Jira backend reads them as `plan_store/jira_epic.py` does: the `plan-item` issue property, its `Filed by` key, and the "is blocked by" links. The contract tests in `contract.py` cover both backends. Touches: @@ -100,14 +100,14 @@ Touches: Where the epic and a repo disagree, the epic wins (`docs/decisions.md` → `do-epic: drives one Jira epic …`). An item without a repo weighs only the epic's goals. Build the chain as one list for `goal_weights`, score with `ranking.item_score` and order with `blockers_first`. `plan/ranking.py` `score` is a place the seats found hard, so the scorer must not add a branch to it. -The epic's and a repo's goal numbers collide, so a Moves cell needs a spelling for a repo's goal beside the epic's; a panel of readers picks it before it ships (`~/.claude/CLAUDE.md` → "Working loop"). The scorer takes the items and each repo's goals as values; item 424 reads them from the tracker, and item 425 re-ranks Jira by the order. +The epic's and a repo's goal numbers collide, so a Moves cell needs a spelling for a repo's goal beside the epic's; a panel of readers picks it before it ships (`~/.claude/CLAUDE.md` → "Working loop"). The scorer takes the items and each repo's goals as values; item 426 reads them from the tracker, and item 427 re-ranks Jira by the order. Touches: - `bin/plan/todo_table.py`: `parse_moves` (small) - `bin/do_epic/ranking.py` -### 425. Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank. +### 427. Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank. Split from item 408 (`docs/decisions.md` → `do-epic: drives one Jira epic …`). `EpicStore` gains a rank call, in both backends and the contract tests. Lift `JiraPlan.rank_refusal` to a module function both stores call. Walk the target order: where the issue at a position isn't the target's, rank the target's just before it; the slots people's issues hold stay theirs. A rank Jira refuses stops the walk and is reported, since a wrongly ranked team backlog takes hours to restore. From 5e75655771fd71880c6af9d860d2fcf929d5eb30 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:06:59 +0100 Subject: [PATCH 26/26] Finish item 408 in the plan --- CHANGELOG.md | 1 + todo.md | 16 ++-------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a41c6d23..24af261a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- do-epic's scorer orders an epic's items by score, then by Blocked by: an item's Moves names a goal as `epic 1.1`, `code health` or `repo 2`, and the epic's achieve goals outweigh the achieve goals of every repo. Nothing calls it yet. - `todo-item add` and `todo-item edit --detail` refuse a detail whose `Touches:` list touch-predictions cannot read, and `rank_todo.py --check` fails on each item holding one, so rule-hook refuses a commit of such a plan: after updating, run `~/.claude/bin/rank_todo.py --check` in each project and fix each list it names. - loop-claude hands each worker's claude a Bash output ceiling of 6,000 characters that saves a longer result to a file, rule-hook refuses a Read of a session transcript under ~/.claude/projects, and review-replay takes --bash-ceiling and --read-limit to test such a limit against archived review rounds. - do-epic picks each epic item's repo, or that it is Claude's work or a human task, by repo-rule.md and a headless claude call, records the pick as a label on the issue and reads it back without a new call; where the rule leaves it unclear it returns a question for the human. The epic backends gain a label write. diff --git a/todo.md b/todo.md index 93e8506a..f9dc7b01 100644 --- a/todo.md +++ b/todo.md @@ -13,10 +13,9 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| | 426 | 0.12.0 | | | **Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | -| 408 | 0.12.0 | | | **Score an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, and order them by score, then by Blocked by.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | -| 427 | 0.12.0 | 408, 426 | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | +| 427 | 0.12.0 | 426 | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | | 401 | 0.12.0 | | | **Move loop-claude's cycle, judge, interrupt, tmux and routing into a package a second entry point drives, with loop-claude's behaviour unchanged.** | 3 | 2 | 3 | 6 | 6 | 1 by 3, code health by 2 | 1.8 | -| 410 | 0.12.0 | 401, 408, 427 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | +| 410 | 0.12.0 | 401, 427 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | | 416 | 0.12.0 | 410 | | **Finish an epic's repo item with a bullet under its repo's `CHANGELOG.md` → `## Unreleased`, or with none where the repo's plan is in Jira.** | 1 | 1 | 1 | 1 | 2 | 1 by 5 | 2.1 | | 413 | 0.12.0 | 410 | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | | 415 | 0.12.0 | 410, 413 | | **Finish an epic: run release-review passes on each repo it changed, work what they file, have the human confirm each goal, post a summary comment, and close the epic in Jira last.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | @@ -96,17 +95,6 @@ Touches: - `bin/do_epic/backend/contract.py` - `bin/do_epic/backend/test_jira.py` -### 408. Score an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, and order them by score, then by Blocked by. - -Where the epic and a repo disagree, the epic wins (`docs/decisions.md` → `do-epic: drives one Jira epic …`). An item without a repo weighs only the epic's goals. Build the chain as one list for `goal_weights`, score with `ranking.item_score` and order with `blockers_first`. `plan/ranking.py` `score` is a place the seats found hard, so the scorer must not add a branch to it. - -The epic's and a repo's goal numbers collide, so a Moves cell needs a spelling for a repo's goal beside the epic's; a panel of readers picks it before it ships (`~/.claude/CLAUDE.md` → "Working loop"). The scorer takes the items and each repo's goals as values; item 426 reads them from the tracker, and item 427 re-ranks Jira by the order. - -Touches: - -- `bin/plan/todo_table.py`: `parse_moves` (small) -- `bin/do_epic/ranking.py` - ### 427. Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank. Split from item 408 (`docs/decisions.md` → `do-epic: drives one Jira epic …`). `EpicStore` gains a rank call, in both backends and the contract tests. Lift `JiraPlan.rank_refusal` to a module function both stores call. Walk the target order: where the issue at a position isn't the target's, rank the target's just before it; the slots people's issues hold stay theirs. A rank Jira refuses stops the walk and is reported, since a wrongly ranked team backlog takes hours to restore.