Name the next release's items without a Touches list, and warn of them in rank_todo.py --check
CI / tests (pull_request) Successful in 4m24s

This commit is contained in:
2026-11-27 20:50:24 +01:00
parent 541ad8988d
commit 3db4b77121
10 changed files with 106 additions and 8 deletions
+1
View File
@@ -14,6 +14,7 @@ How work proceeds in any repo, unless the repo's `AGENTS.md` says otherwise. The
- **A client project's `CLAUDE.md` and `AGENTS.md` in its repo belong to its team.** Read both at the start of each chunk there. Propose each change that aligns them with this setup in a pull request of its own, never inside a chunk's; the one edit a chunk makes there is a decision's title in `AGENTS.md`. Until the team accepts a proposal, and after it declines or doesn't answer, follow the team's rule unless it breaks one of the project's goals. Record each such conflict as a decision in the `decisions` record, as `rules/decisions.md` asks: which rule you follow, why, and the open proposal's PR. Then nobody is asked twice.
- **Read the goals file's `## Goals` and `## Audience` before starting a chunk, unless your prompt quotes them.** The chunk's items set its scope. The goals choose between ways to deliver those items, and never add to them.
- **Read the plan and the decisions only as far as the chunk needs.** Where your prompt quotes `chunk-preflight`'s facts, they hold the next item's L, E + I, tagline and detail, and each item that may join it with its L, E + I, S, tagline and detail; run `todo-item` only for what they leave out. Otherwise run `~/.claude/bin/todo-item list`, which prints every item's row in the plan's order, without details. Then read the details of only the items the chunk takes, with `~/.claude/bin/todo-item show <ID>`, which prints an item's row and detail. `AGENTS.md` lists the project principles and the title of each decision no project principle covers. Read an entry in `docs/decisions.md` only where the project principle or the title leaves open what the chunk or the review needs. Print one entry with `~/.claude/bin/markdown-section <file> <fragment of its title>`, where `<file>` is what `~/.claude/bin/project-record open decisions` prints.
- **Where `chunk-preflight`'s facts name items with no `Touches:` list, have one subagent write the lists before the chunk's own work.** Without them no other chunk may start beside this one. Launch it on the rung "Working with the codebase" gives a subagent that files or scores plan items. It reads the code and adds a list to each named item's detail with `todo-item edit <ID> --detail`, as `~/.claude/rules/todo-items.md` says, changing nothing else in the detail. Where it cannot tell which part of a file the item changes, it lists the whole file and says in the detail that the change is not predictable. It leaves alone a list an item already holds, even one a later edit of the item made stale. Where the plan is a file in the repo, it works in a worktree of its own off `origin/main`, and ships the plan as a pull request of its own with `chunk-pr`.
- **Work one chunk at a time, and put every item that can share its review into it.** Every review has a fixed cost, so a chunk takes the next plan item plus every other item for which three things hold: they name one release; they fire the same review passes (`larv-review` §3); and no item outside the chunk blocks one of them. The items need not share a purpose. An item whose risk R, in the plan, is above 5 ships alone: it joins no chunk, and none joins it. The next plan item is the first that does not wait: an item waits while it is marked `question`, until the human answers, or while an item that blocks it is still in the plan. Tiny items, a few lines of change each, need not fire the same passes: bundle up to ten that name one release, and that no item outside the chunk blocks, into one chunk. Split a milestone into items in the plan before starting it. Fix a finding in the chunk's own change within the chunk. File a finding about anything else in `todo.md`.
- **Ask, don't guess.** Three choices are always the human's: a goal; a release, meaning the items planned into it and when it is cut; and a change to loop-claude's routing ladder, its rungs included. Any other rule that asks the human's approval reserves that choice too. Ask about a reserved choice. For any other choice, first check whether the goals already answer it. If they nearly do, propose a change to the goals and show how it answers this case: an answer settles one question, a goal settles every question like it. Otherwise take the option you would recommend, and record it with its reason: in the item's detail, or, where it governs later work, as the next sentence says. A recommendation you can give a reason for is not a guess. Ask only where you have no recommendation. Write every answer once, where it belongs, never only in chat: a goal in the goals file, a working rule in `AGENTS.md`, a standing choice in a comment at the one place it governs, or in `docs/decisions.md` once made in more than one place. When an answer holds a goal and a choice, write the goal in the goals file, and record as a choice only what the goal leaves open.
- **Bench a syntax with the people who write it.** Before a new or changed spelling of something users read or write ships — markdown, HTML, a config key, a CLI flag — a panel of fresh-context readers, seated as those users from the goals file's `## Audience`, picks it.
+16 -1
View File
@@ -1,5 +1,5 @@
"""The lines the preflight prints, stated from what it gathered."""
from plan.todo_table import bundle_candidates, BUNDLE_MAX_R, Item, ships_alone
from plan.todo_table import bundle_candidates, BUNDLE_MAX_R, Item, next_item, ships_alone
from touch_predictions.beside import chunks_beside
from release_plan.next_chunk import cut_name, NextChunk, NoItem
from release_plan.release_standing import dated_cut, LastCut, unreleased_entries, UNSEEN_RELEASES
@@ -9,6 +9,7 @@ from chunk_preflight.gathered import Gathered, ItemFacts, NamedPath, Ran
from text_files.markdown_text import listed, quoted
from chunk_preflight.choices import PULLS_LIST
from chunk_preflight.indentation import SpaceIndented
from plan.touches import unpredicted
from plan.release import version
@@ -73,6 +74,7 @@ def item_lines(plan: str, item: ItemFacts) -> list[str]:
f"- Open pull requests from {item.plan.branch}: {pulls_text(item.pulls, item.plan.branch)}",
*bundled(item.plan),
*beside(item.plan),
*unpredicted_lines(item.plan),
*named_lines(item.named),
f"\nItem {first.id}'s tagline and detail:\n\n{quoted(item.plan.text)}",
*joining_details(item.plan),
@@ -147,6 +149,19 @@ def beside(plan: NextChunk) -> list[str]:
return [f"- The items of release {version(first.release)} that may start chunks beside item {first.id}'s: {', '.join(map(str, found.picked))}. None is predicted to touch a part that item {first.id} touches, or that an item earlier in this list touches. An item this chunk takes doesn't start a chunk of its own.{refused}"]
def unpredicted_lines(plan: NextChunk) -> list[str]:
"""The items of first's release without a `Touches:` list, for the worker to have a subagent write; no line where each holds one or first is alone in its release, where no chunk could start beside its.
Only the chunk of the plan's next item gets the line: a chunk that starts beside it would have a second subagent write the same lists."""
first = plan.first
missing = unpredicted(plan.items, first.release)
alone = sum(item.release == first.release for item in plan.items) < 2
if not missing or alone or next_item(plan.items) != first:
return []
them = "them" if missing.startswith("items") else "it"
return [f'- {missing[0].upper()}{missing[1:]}. Before the chunk, have one subagent write {them}, as `~/.claude/CLAUDE.md` → "Working loop" says.']
def named_lines(named: list[NamedPath] | Failure) -> list[str]:
if isinstance(named, Failure):
return [f"- The files the item names: cannot be listed: {named.reason}"]
+4
View File
@@ -71,6 +71,10 @@ and prints that the release reviews and the cuts are the human's to call. It pri
it in the plan's order. A part either prediction marks (small) doesn't count. This line is left
out where no item of the release that doesn't wait holds a prediction. The plan and the records
belong in no prediction, since every chunk writes them;
- the items of that release whose details hold no `Touches:` list, for the worker to have a
subagent write, as `~/.claude/CLAUDE.md` → "Working loop" says. This line is left out where
the item is alone in its release, and where it is not the plan's next item: the chunk of the
next item gets the line, so the lists are written once;
- each file or folder git tracks that the item's tagline or detail names in backticks, with a
file's lines or a folder's files, then the item's tagline and detail, then the detail of each
of the first {JOINING_DETAILS} items that may join, or that one has none;
@@ -2,6 +2,7 @@ import contextlib
import dataclasses
import os
import pathlib
import re
import shutil
import subprocess
import sys
@@ -867,6 +868,34 @@ class BesideTest(unittest.TestCase):
self.assertEqual(self.said(TODO), [])
class UnpredictedTest(unittest.TestCase):
"""The fact that names the next release's items whose details hold no `Touches:` list."""
LIST = "\nTouches:\n\n- `src/app.py`: `run`\n"
# Item 3's detail ends TODO, so the first list is item 3's.
LISTED = TODO + LIST + f"\n### 5. Do it.\n{LIST}\n### 7. Do it.\n{LIST}\n### 8. Do it.\n{LIST}"
def said(self, todo, *named):
return [line for line in rendered(item_facts(todo, plan=planned(todo, CUT, "origin/main", BRANCH, None, *named))).splitlines() if "have no `Touches:` list" in line or "has no `Touches:` list" in line]
def test_says_nothing_where_every_item_of_the_release_holds_a_list(self):
self.assertEqual(self.said(self.LISTED), [])
def test_names_each_item_without_a_list_where_other_items_of_the_release_wait(self):
self.assertEqual(self.said(self.LISTED.replace(f"\n### 7. Do it.\n{self.LIST}", "")), ['- Item 7 of release 0.2.0 has no `Touches:` list. Before the chunk, have one subagent write it, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
self.assertEqual(self.said(TODO), ['- Items 5, 3, 7 and 8 of release 0.2.0 have no `Touches:` list. Before the chunk, have one subagent write them, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
def test_says_nothing_of_an_item_alone_in_its_release(self):
alone = "\n".join(line for line in TODO.splitlines() if not re.match(r"\| [578] \|", line)) + "\n"
self.assertEqual(self.said(alone), [])
def test_leaves_alone_a_list_an_edit_of_its_item_made_stale(self):
# Item 3's detail names `src/app.py`'s `run`, and its list another file: only a missing list is written.
self.assertEqual(self.said(self.LISTED.replace("- `src/app.py`: `run`", "- `src/old.py`", 1)), [])
def test_says_it_only_to_the_chunk_of_the_plans_next_item(self):
# Item 8's chunk starts beside item 3's, whose worker writes the lists: two subagents would write them twice.
self.assertEqual(self.said(TODO.replace("| 8 | 0.2.0 | 5 |", "| 8 | 0.2.0 | |"), 8), [])
if __name__ == "__main__":
unittest.main()
+11
View File
@@ -17,6 +17,9 @@ import dataclasses
import re
from failure import Failure
from plan.todo_table import Item
from text_files.markdown_text import listed
from plan.release import Release, version
LABEL = "Touches:"
SMALL = " (small)"
@@ -146,3 +149,11 @@ def same_part(one: Part, other: Part) -> bool:
if spans[0] or spans[1]:
return True
return one.name == other.name or one.name.startswith(f"{other.name}.") or other.name.startswith(f"{one.name}.")
def unpredicted(found: list[Item], release: Release) -> str | None:
"""Which of release's items hold no `Touches:` list in their details, in found's order, as a clause such as ``items 3 and 7 of release 0.2.0 have no `Touches:` list``; None where each holds one. A list that cannot be read is not missing: `rank_todo.py --check` fails on that one. Nor is one its item's later edit made stale, so a list is written once."""
missing = [str(item.id) for item in found if item.release == release and predicted(item.detail) is None]
if not missing:
return None
return f"item{'s' if len(missing) > 1 else ''} {listed(missing, 'and')} of release {version(release)} ha{'ve' if len(missing) > 1 else 's'} no `{LABEL}` list"
+9 -1
View File
@@ -7,7 +7,7 @@ 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.touches import predicted, unpredicted
from plan import ranking
from record_store.stores import RecordStore
from text_files.file_writes import replace_file
@@ -95,6 +95,14 @@ class FilePlan:
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 + unreadable_touches(texts[0])]
def warnings(self) -> list[str]:
"""What `rank_todo.py --check` says of the file without failing on it: which items of its earliest release hold no `Touches:` list."""
plan = self.read()
if isinstance(plan, Failure) or not plan.items:
return []
missing = unpredicted(plan.items, min(item.release for item in plan.items))
return [f"{self.path}: warning: {missing}; write each as `~/.claude/rules/todo-items.md` says"] if missing else []
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."""
return [f"{self.path}: {line}" for line in ranked.notes + ranked.under_bar]
+3 -2
View File
@@ -12,7 +12,8 @@ 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 not spelt as `touch-predictions --help` shows.
`Touches:` list not spelt as `touch-predictions --help` shows. On a file that passes, it warns on
stderr, still exiting 0, where items of the earliest release hold no `Touches:` list, naming them.
A valid todo.md; ## Details and each item's detail are optional:
@@ -120,7 +121,7 @@ def main(argv: list[str], home: pathlib.Path) -> int:
plan = file_plan(config, todo)
if check:
failures = plan.check()
for line in failures:
for line in failures or plan.warnings():
print(line, file=sys.stderr)
return 1 if failures else 0
ranked = plan.rank()
+23 -3
View File
@@ -14,6 +14,9 @@ from plan import goals_file, ranking
import rank_todo
from todo_item.doubles import READABLE_TOUCHES, UNREADABLE_BULLETS
# What --check says of plan.doubles' TODO, none of whose items of the next release, 0.1.0, holds a list. The order is the ranked table's.
UNPREDICTED = "items 4, 3, 2 and 5 of release 0.1.0 have no `Touches:` list; write each as `~/.claude/rules/todo-items.md` says"
class Main(unittest.TestCase):
# The home of a test that writes no config.
@@ -41,7 +44,7 @@ class Main(unittest.TestCase):
self.assertEqual(self.run_main("--check", str(todo))[0], 1)
self.assertEqual(todo.read_text(), TODO)
self.assertEqual(self.run_main(str(todo)), (0, ""))
self.assertEqual(self.run_main("--check", str(todo)), (0, ""))
self.assertEqual(self.run_main("--check", str(todo)), (0, f"{todo}: warning: {UNPREDICTED}\n"))
pathlib.Path(temp, "README.md").write_bytes(b"\xff")
self.assertEqual(self.run_main(str(todo)), (1, f"cannot read {temp}/README.md: not UTF-8 on line 1\n"))
pathlib.Path(temp, "README.md").unlink()
@@ -62,7 +65,7 @@ class Main(unittest.TestCase):
(folder / "decisions.md").write_text(DECISIONS)
self.assertEqual(self.run_main("--check")[0], 1, "the plan in the config's folder is not ranked yet")
self.assertEqual(self.run_main(), (0, ""))
self.assertEqual(self.run_main("--check"), (0, ""))
self.assertEqual(self.run_main("--check"), (0, f"{folder / 'todo.md'}: warning: {UNPREDICTED}\n"))
self.assertEqual(pathlib.Path(temp, "todo.md").read_text(), "the project owners' own notes\n")
(folder / "decisions.md").write_bytes(b"\xff")
self.assertEqual(self.run_main(), (1, f"cannot read {folder}/decisions.md: not UTF-8 on line 1\n"))
@@ -111,6 +114,23 @@ 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_warns_without_failing_on_the_next_releases_items_without_a_touches_list(self):
with tempfile.TemporaryDirectory() as temp:
todo = pathlib.Path(temp, "todo.md")
self.configured(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)
# Item 3 of the next release, 0.1.0, holds a list; item 1 of 0.2.0 holds none, and is not named.
todo.write_text(TODO.replace("Fast detail.", READABLE_TOUCHES))
self.assertEqual(self.run_main(str(todo))[0], 0)
self.assertEqual(self.run_main("--check", str(todo)), (0, f"{todo}: warning: {UNPREDICTED.replace('3, ', '')}\n"))
every = "".join(f"### {id_}. Do it.\n\n{READABLE_TOUCHES}\n" for id_ in (2, 4, 5))
todo.write_text(todo.read_text().replace("## Notes", f"{every}## Notes"))
self.assertEqual(self.run_main(str(todo))[0], 0)
self.assertEqual(self.run_main("--check", str(todo)), (0, ""))
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")
@@ -140,7 +160,7 @@ class Main(unittest.TestCase):
pathlib.Path(temp, "docs").mkdir()
pathlib.Path(temp, "docs", "decisions.md").write_text(DECISIONS)
self.assertEqual(self.run_main(str(todo)), (0, f"{todo}: {ranking.RESHAPE}\n"))
self.assertEqual(self.run_main("--check", str(todo)), (0, ""))
self.assertEqual(self.run_main("--check", str(todo))[0], 0)
def test_shows_a_valid_file_in_help_and_names_arguments_it_cannot_read(self):
self.assertEqual(self.run_main("--help")[0], 0)
+9
View File
@@ -3815,3 +3815,12 @@ Read most (opens and searches):
- `skills/larv-review/SKILL.md` 5
- `agents/stability-reviewer.md` 4
- `README.md` 1
## Reading cost, chunk 3756be76994f, finished 2026-11-27T19:41:34Z
52954 new input tokens before the first commit.
Read most (opens and searches):
- `principles/technical-principles.md` 7
- `agents/stability-reviewer.md` 1
+1 -1
View File
@@ -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 <ID>: <why>`,** or `Drop items 12, 14 and 15: <why>` 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. A part is a name in backticks, or `lines <first>-<last>`. 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.
- **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 <first>-<last>`. 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. `rank_todo.py --check` warns, without failing, of each item of the earliest release that has no list, and `chunk-preflight` names them where other items of the release wait, for a subagent to write (`CLAUDE.md` → "Working loop").