Answer stability round 1: 0 🔴, 2 🟡 (0 misread); state the warning as a fact and key the rule on the fact line

This commit is contained in:
2026-11-27 21:24:47 +01:00
parent f89bdd9938
commit 00bf996149
8 changed files with 30 additions and 24 deletions
+1 -1
View File
@@ -14,7 +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`.
- **Where a line of `chunk-preflight`'s facts says to have one subagent write `Touches:` lists, launch it before the chunk's own work.** `rank_todo.py --check`'s warning of items with no list, which the facts also quote, doesn't call for it: only the next item's chunk gets that line, so the lists are written once. An item without a list starts no chunk beside another's. Launch the subagent 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, and doesn't change anything 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 the default branch, 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.
+4 -4
View File
@@ -9,7 +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.touches import unpredicted, without_a_list
from plan.release import version
@@ -150,7 +150,7 @@ def beside(plan: NextChunk) -> list[str]:
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.
"""The line that names the items of first's release without a `Touches:` list and has the worker launch a subagent to write the lists. No line where each item holds a list. No line either where first is alone in its release: no chunk could start beside first's then.
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
@@ -158,8 +158,8 @@ def unpredicted_lines(plan: NextChunk) -> list[str]:
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.']
clause = without_a_list(missing, first.release)
return [f'- {clause[0].upper()}{clause[1:]}. Before the chunk, have one subagent write each missing list, as `~/.claude/CLAUDE.md` → "Working loop" says.']
def named_lines(named: list[NamedPath] | Failure) -> list[str]:
+2 -2
View File
@@ -71,8 +71,8 @@ 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 items of that release whose details hold no `Touches:` list, whose lists the worker has
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
+5 -5
View File
@@ -881,13 +881,13 @@ class UnpredictedTest(unittest.TestCase):
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.'])
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 each missing list, 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 each missing list, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
def test_names_two_items_and_one_of_two(self):
self.assertEqual(self.said(self.LISTED.replace(f"### 5. Do it.\n{self.LIST}", "").replace(f"### 7. Do it.\n{self.LIST}", "")), ['- Items 5 and 7 of release 0.2.0 have no `Touches:` list. Before the chunk, have one subagent write them, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
self.assertEqual(self.said(self.LISTED.replace(f"### 5. Do it.\n{self.LIST}", "").replace(f"### 7. Do it.\n{self.LIST}", "")), ['- Items 5 and 7 of release 0.2.0 have no `Touches:` list. Before the chunk, have one subagent write each missing list, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
pair = "\n".join(line for line in TODO.splitlines() if not re.match(r"\| [58] \|", line)) + "\n"
self.assertEqual(self.said(pair + 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(pair + self.LIST), ['- Item 7 of release 0.2.0 has no `Touches:` list. Before the chunk, have one subagent write each missing list, 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"
@@ -898,7 +898,7 @@ class UnpredictedTest(unittest.TestCase):
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.
# Item 8's chunk starts beside item 3's, whose worker has a subagent write the lists: a second subagent would write the same ones.
self.assertEqual(self.said(TODO.replace("| 8 | 0.2.0 | 5 |", "| 8 | 0.2.0 | |"), 8), [])
+9 -6
View File
@@ -151,9 +151,12 @@ def same_part(one: Part, other: Part) -> bool:
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"
def unpredicted(found: list[Item], release: Release) -> list[int]:
"""The IDs of release's items that hold no `Touches:` list in their details, in found's order. A list that cannot be read is not missing: `rank_todo.py --check` fails on that one. A list that a later edit of its item made stale is not missing either, so a list is written once."""
return [item.id for item in found if item.release == release and predicted(item.detail) is None]
def without_a_list(ids: list[int], release: Release) -> str:
"""What unpredicted found, as a clause that states it and tells the reader to do nothing, such as ``items 3 and 7 of release 0.2.0 have no `Touches:` list``."""
several = len(ids) > 1
return f"item{'s' * several} {listed([str(id_) for id_ in ids], 'and')} of release {version(release)} ha{'ve' if several else 's'} no `{LABEL}` list"
+5 -3
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, unpredicted
from plan.touches import predicted, unpredicted, without_a_list
from plan import ranking
from record_store.stores import RecordStore
from text_files.file_writes import replace_file
@@ -96,12 +96,14 @@ class FilePlan:
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."""
"""What `rank_todo.py --check` says of the file without failing on it: which items of its earliest release hold no `Touches:` list.
The line states that and tells the reader to do nothing: `chunk-preflight` quotes it into every chunk's facts, and only the fact of `chunk_preflight.facts.unpredicted_lines` has a subagent write the lists."""
plan = self.read()
if isinstance(plan, Failure):
return []
earliest = sorted({item.release for item in plan.items})[:1]
return [f"{self.path}: warning: {missing}; write each as `~/.claude/rules/todo-items.md` says" for release in earliest if (missing := unpredicted(plan.items, release))]
return [f"{self.path}: warning: {without_a_list(missing, release)}" for release in earliest if (missing := unpredicted(plan.items, release))]
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."""
+3 -2
View File
@@ -15,7 +15,7 @@ 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"
UNPREDICTED = "items 4, 3, 2 and 5 of release 0.1.0 have no `Touches:` list"
class Main(unittest.TestCase):
@@ -160,7 +160,8 @@ 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], 0)
# The old shape holds the items TODO does, so the check warns of the same ones, in the order ranking gives them.
self.assertEqual(self.run_main("--check", str(todo)), (0, f"{todo}: warning: {UNPREDICTED}\n"))
def test_shows_a_valid_file_in_help_and_names_arguments_it_cannot_read(self):
self.assertEqual(self.run_main("--help")[0], 0)
+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. `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").
- **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 the release holds other items, so that a subagent writes their lists (`CLAUDE.md` → "Working loop").