diff --git a/bin/loop_claude/cycle/prompts.py b/bin/loop_claude/cycle/prompts.py index 51e8add3..71c0cf32 100644 --- a/bin/loop_claude/cycle/prompts.py +++ b/bin/loop_claude/cycle/prompts.py @@ -13,7 +13,7 @@ QUOTE_SOURCES = listed(("README.md's Goals and Audience", *RECORD_FILES, *HUMAN_ # Where the worker may write an answer the human typed, so it counts as recorded. ANSWER_DESTINATIONS = "README.md's Goals or Audience, " + ", ".join(RECORD_FILES) + ", todo.md or a comment" ANSWERS_RECORDED = f"every answer the human typed in it that a later chunk could need is recorded in {ANSWER_DESTINATIONS} at the one place it governs" -# How the launch and rerun sentences name the reviews that no replay lowered: "each reviewer" for every such pass, then the two reviews that are no pass. +# How review_launches names the reviews that no replay lowered: "each reviewer" for every such pass, then the two reviews that are no pass. EACH_REVIEWER = "each reviewer" EACH_SEAT = "each comprehension seat" THE_SECURITY_PASS = "the security pass's subagent" @@ -24,9 +24,9 @@ AFTER_CODE_HEALTH = 'which rank after code health (~/.claude/CLAUDE.md → "Shar def fresh(task: str, premises: str, route: Route, project: Rung | None, facts: str) -> str: """A chunk's first prompt; facts is preflight_facts' or preflight_failed's text.""" - unrouted = " ".join(rung_sentences(route, project)) - routed = f"{routed_by(route, project)} {recount(route)}\n\n" if route.item else (f"{unrouted}\n\n" if unrouted else "") - return f"{task}\n\nContinue any open draft PR or worktree for the chunk before creating a new one.\n\n{routed}{facts}\n\nThe chunk's todo.md items, or else the task above, set its scope. The goals below, {AFTER_CODE_HEALTH}, choose between ways to deliver that scope, and never widen it.\n\nFrom README.md:\n{premises}" + routed = f"{routed_by(route, project)} {recount(route)}" if route.item else " ".join(rung_sentences(route, project)) + opening = f"{routed}\n\n" if routed else "" + return f"{task}\n\nContinue any open draft PR or worktree for the chunk before creating a new one.\n\n{opening}{facts}\n\nThe chunk's todo.md items, or else the task above, set its scope. The goals below, {AFTER_CODE_HEALTH}, choose between ways to deliver that scope, and never widen it.\n\nFrom README.md:\n{premises}" def routed_by(route: Route, project: Rung | None) -> str: @@ -84,7 +84,7 @@ def taken_in_launches(choice: ReviewChoice) -> list[str]: if not choice.higher: return [] picks = [f"`{rung.agent_args()}` from {escape_and_impact}" for rung, escape_and_impact in choice.higher.items()] - return [f"Where an item you take into the chunk has an E + I of {min(choice.higher.values())} or more, launch each reviewer with the Agent tool set to {listed(picks, 'and')}."] + return [f"Where an item you take into the chunk has an E + I of {min(choice.higher.values())} or more, launch {EACH_REVIEWER} with the Agent tool set to {listed(picks, 'and')}."] def rung_named(rung: Rung, route: Route, project: Rung) -> str: diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 8cef7e70..154b39be 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -56,8 +56,9 @@ session /talk opens run on the rung that the chunk's todo.md item picks, and the models on another; a chunk no item routes runs on the project's model. The worker's prompts name the rungs it launches its reviews on. The worker's rung steps up as a chunk stays unfinished, or when the judge finds in the transcript an escalation trigger that fired and the worker asked for a higher -rung. The rules are in bin/loop_claude/routing.py and bin/model_routing/ladder.py, and the prompts' -wording in bin/loop_claude/cycle/prompts.py. Each verdict, interrupt, quoted answer, stop and +rung. The rules are in bin/loop_claude/routing.py and bin/model_routing/ladder.py, the choice of +each review's rung in bin/model_routing/review_choice.py, and the prompts' wording in +bin/loop_claude/cycle/prompts.py. Each verdict, interrupt, quoted answer, stop and step-up in the archive ends with a Worker: line, the route's JSON record (Route.record in bin/model_routing/route.py); a rerun resumes an open chunk on the latest route named there. A todo.md or an archive that cannot be read or parsed is said on stderr, and the chunk is routed diff --git a/bin/model_routing/review_choice.py b/bin/model_routing/review_choice.py index 739eed80..e28b21c3 100644 --- a/bin/model_routing/review_choice.py +++ b/bin/model_routing/review_choice.py @@ -1,9 +1,9 @@ -"""Where a chunk's reviews run: the choice loop_claude/cycle/prompts.py tells the worker in sentences.""" +"""Where a chunk's reviews run, chosen from its route and the project's rung.""" import dataclasses from model_routing.route import HIGHEST_ESCAPE_AND_IMPACT, Route -from model_routing.ladder import review_rungs, ReviewedPass, reviewers_rung, Rung -from review_passes import REVIEWERS +from model_routing.ladder import review_rungs, reviewers_rung, Rung +from review_passes import ReviewedPass, REVIEWERS @dataclasses.dataclass(frozen=True) @@ -14,7 +14,7 @@ class ReviewChoice: lowered: dict[ReviewedPass, Rung] seat: Rung security: Rung - # Each rung that a higher E + I than the route's picks for the reviewers, with the lowest E + I that picks it, so a worker that takes in such an item reviews it on that rung in the same run. + # Each rung that a higher E + I than the route's picks for the reviewers, with the lowest E + I that picks it, lowest E + I first, so a worker that takes in such an item reviews it on that rung in the same run. higher: dict[Rung, int] diff --git a/bin/model_routing/test_review_choice.py b/bin/model_routing/test_review_choice.py index db3f3e01..8bf89f58 100644 --- a/bin/model_routing/test_review_choice.py +++ b/bin/model_routing/test_review_choice.py @@ -29,7 +29,7 @@ class Chosen(unittest.TestCase): self.assertEqual(chosen(OPUS, Route(OPUS, 3, 3, 4)).higher, {OPUS_HIGH: 5, OPUS_XHIGH: 6, OPUS_MAX: 7, FABLE: 8}) def test_names_no_higher_rung_on_the_top_one(self): - self.assertEqual(chosen(OPUS, Route(FABLE, 3, 4, 8)).higher, {}) + self.assertEqual(chosen(OPUS, Route(FABLE, 3, 4, 5)).higher, {}) def test_puts_a_pass_a_replay_lowered_on_the_rung_the_replay_chose_while_no_e_plus_i_lifts_a_review(self): with unittest.mock.patch.dict(ladder.REPLAYED, {("prose", "claude-opus-5-5"): HAIKU}): diff --git a/todo.md b/todo.md index ba7a0afb..c896c911 100644 --- a/todo.md +++ b/todo.md @@ -68,7 +68,7 @@ | 155 | 0.5.0 | | | **Lower the reading cost of the files a chunk reads most before its first commit.** | 3 | 2 | 2 | 5 | 5 | 1.4 by 6 | 2.4 | | 51 | 0.5.0 | | principle | **Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints.** | 2 | 1 | 3 | 4 | 5 | 1.1 by 5 | 2.1 | | 169 | 0.5.0 | | | **Have rule-hook's `todo-rank-check` catch a `todo.md` that the same Bash call edits and then commits.** | 3 | 1 | 3 | 5 | 3 | 1.1 by 2 | 2.1 | -| 174 | 0.5.0 | | | **In a chunk no item routed, ask the worker to name each todo.md item it takes, with its L and E + I, so loop-claude can route on an item it takes in.** | 1 | 2 | 3 | 4 | 2 | 1.1 by 1 | 1.4 | +| 174 | 0.5.0 | | | **In a chunk no item routed, ask the worker to name each todo.md item it takes, with its L and E + I, so loop-claude can route on an item it takes in.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 1 | 1.7 | | 197 | 0.5.0 | | | **Let the human edit what they type at loop-claude's terminal questions with the arrow keys, so Left moves the cursor in place of printing `^[[D`.** | 2 | 2 | 3 | 5 | 2 | 1.5 by 1 | 1.3 | | 52 | 0.5.0 | | principle | **Record why this checkout lives in Claude Code's own directory, or move it out and link it in.** | 4 | 3 | 4 | 9 | 6 | 1.1 by 4 | 0.9 | @@ -346,7 +346,7 @@ The hook judges a call before it runs, and `changed` in `bin/rule_hook/todo_chec ### 174. In a chunk no item routed, ask the worker to name each todo.md item it takes, with its L and E + I, so loop-claude can route on an item it takes in. -The principles pass of PR #301 found that only `routed_by` in `bin/loop_claude/cycle/prompts.py` asks the worker to name each item it takes with its L and E + I, and `fresh` uses it only where an item routed the chunk. In an unrouted chunk the judge has no levels to report, so neither the taken-in L nor the taken-in E + I lifts the worker, the reviewers or the judge, and the first prompt names no reviewers' rung for a higher E + I. +The principles pass of PR #301 found that only `routed_by` in `bin/loop_claude/cycle/prompts.py` asks the worker to name each item it takes with its L and E + I, and `fresh` uses it only where an item routed the chunk. In an unrouted chunk the judge has no levels to report, so neither the taken-in L nor the taken-in E + I lifts the worker, the reviewers or the judge. ### 197. Let the human edit what they type at loop-claude's terminal questions with the arrow keys, so Left moves the cursor in place of printing `^[[D`.