diff --git a/bin/loop_claude/cycle/prompts.py b/bin/loop_claude/cycle/prompts.py index c25d209a..51e8add3 100644 --- a/bin/loop_claude/cycle/prompts.py +++ b/bin/loop_claude/cycle/prompts.py @@ -1,4 +1,4 @@ -"""What loop-claude says to the worker each cycle. model_routing.review_choice chooses where the reviews run; review_launches and reruns say that choice in whole sentences, and escalation says where escalated subagents run. rung_sentences gathers the three, which routed_by puts in a chunk's first prompt and rungs_held says again after a step-up or an unfinished verdict.""" +"""What loop-claude says to the worker each cycle. model_routing.review_choice chooses where the reviews run; review_launches and reruns say that choice in whole sentences, and escalation says where escalated subagents run. rung_sentences gathers the three, which fresh puts in a chunk's first prompt, after routed_by's routing sentences where an item routed the chunk, and rungs_held says again after a step-up or an unfinished verdict.""" from model_routing.review_choice import chosen, ReviewChoice from model_routing.ladder import climbed, LADDER, position, Rung from model_routing.route import ESCALATION_MARKER, Route @@ -24,8 +24,8 @@ 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.""" - escalated = " ".join((*escalation(route, project), *reruns(route, project))) - routed = f"{routed_by(route, project)} {recount(route)}\n\n" if route.item else (f"{escalated}\n\n" if escalated else "") + 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}" diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index 683787a0..eebf8c23 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -1173,7 +1173,7 @@ class WorkerArgs(unittest.TestCase): self.assertIn("hand the hard part of the task to a subagent with the Agent tool set to `model opus, effort max`, one rung above yours;", prompts.resumed("", Route(Rung("claude-opus-5-5", "xhigh"), 3, 4, 5), opus)) self.assertNotIn("escalation", prompts.resumed("", Route(Rung("m")), None)) self.assertNotIn("escalation", prompts.resumed("", Route(Rung("claude-opus-5-5", "low"), 3, 3, 4), opus)) - self.assertIn("before creating a new one.\n\nWhen an escalation trigger in `~/.claude/CLAUDE.md` fires, hand the hard part of the task to a subagent with the Agent tool set to `model opus, effort high`, one rung above yours, and on each further trigger one rung higher, up to `model opus, effort xhigh`; above that, ask the human first. Open the subagent's prompt with `Escalation trigger :`, n the trigger's number. Where the hard part is the rest of the chunk, end your run instead, asking loop-claude for a higher rung and naming a trigger that fired since your last step-up, if any: once the judge finds it in your transcript, the next cycle resumes you one rung up, up to `model opus, effort xhigh`. A reviewer", prompts.fresh("Do it.", "## Goals", Route(opus), opus, self.FACTS)) + self.assertIn("before creating a new one.\n\nWhere an item you take into the chunk has an E + I of 5 or more, launch each reviewer with the Agent tool set to `model opus, effort high` from 5, `model opus, effort xhigh` from 6, `model opus, effort max` from 7 and `model fable, effort max` from 8. When an escalation trigger in `~/.claude/CLAUDE.md` fires, hand the hard part of the task to a subagent with the Agent tool set to `model opus, effort high`, one rung above yours, and on each further trigger one rung higher, up to `model opus, effort xhigh`; above that, ask the human first. Open the subagent's prompt with `Escalation trigger :`, n the trigger's number. Where the hard part is the rest of the chunk, end your run instead, asking loop-claude for a higher rung and naming a trigger that fired since your last step-up, if any: once the judge finds it in your transcript, the next cycle resumes you one rung up, up to `model opus, effort xhigh`. A reviewer", prompts.fresh("Do it.", "## Goals", Route(opus), opus, self.FACTS)) def test_offers_the_worker_a_higher_rung_for_the_rest_of_the_chunk_up_to_the_escalation_cap(self): opus = Rung("claude-opus-5-5", "medium") diff --git a/bin/model_routing/review_choice.py b/bin/model_routing/review_choice.py index 3a38e69e..739eed80 100644 --- a/bin/model_routing/review_choice.py +++ b/bin/model_routing/review_choice.py @@ -1,8 +1,8 @@ """Where a chunk's reviews run: the choice loop_claude/cycle/prompts.py tells the worker in sentences.""" import dataclasses -from model_routing.ladder import ReviewedPass, review_rungs, reviewers_rung, Rung 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 diff --git a/bin/model_routing/test_review_choice.py b/bin/model_routing/test_review_choice.py index c6aad599..db3f3e01 100644 --- a/bin/model_routing/test_review_choice.py +++ b/bin/model_routing/test_review_choice.py @@ -1,10 +1,10 @@ import unittest import unittest.mock -from model_routing import ladder -from model_routing.ladder import Rung from model_routing.review_choice import chosen, ReviewChoice +from model_routing import ladder from model_routing.route import Route +from model_routing.ladder import Rung HAIKU = Rung("claude-haiku-5-5", "low") OPUS = Rung("claude-opus-5-5", "medium")