Answer architecture round 1: 0 🔴, 5 🟡; keep a taken-in E + I only where it lifts the reviewers, outside stepped, parse the archived line once, point the help at the code, and name the field one way

This commit is contained in:
2026-10-16 23:45:11 +02:00
parent ba4a00d6b7
commit 6df1833eb7
5 changed files with 42 additions and 38 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ def rung_named(rung: Rung, route: Route, anchor: Rung) -> str:
"""Why a review runs on rung: it is the project's, anchor, or the one the route's reviewed_on E + I picks, the item's or one taken in."""
if rung == anchor:
return "the project's rung"
if route.escape_and_impact_taken_in > route.escape_and_impact:
if route.escape_and_impact_taken_in:
return f"the rung an E + I of {route.escape_and_impact_taken_in} taken into the chunk picks"
return f"the rung item {route.item}'s E + I of {route.escape_and_impact} picks"
+7 -6
View File
@@ -63,10 +63,11 @@ loop-claude hands the worker's claude its own rung, the project's and the review
LOOP_CLAUDE_WORKER_RUNG, LOOP_CLAUDE_PROJECT_RUNG and LOOP_CLAUDE_REVIEWER_RUNG, and rule-hook
refuses a review launched below the rung named for it. The judge reports the highest L and the
highest E + I the worker states for an item it takes in. The next cycle steps the worker up to the
rung that L picks, never down, and the reviewers to the rung the higher of that E + I and the routed
item's picks; a level off its scale counts as none. Every second unfinished
verdict on a chunk steps it up one rung. So does an unfinished verdict on a worker that ended its
run asking for a higher rung, once the judge quotes the transcript showing that the escalation
rung that L picks, never down, and the reviewers to the rung the higher of that E + I and the
routed item's picks (Route.reviewed_on in bin/model_routing/route.py); a level off its scale
counts as none. Every second unfinished verdict on a chunk steps it up one rung (stepped in
bin/loop_claude/routing.py). So does an unfinished verdict on a worker that ended its run asking
for a higher rung, once the judge quotes the transcript showing that the escalation
trigger it named fired (~/.claude/CLAUDE.md → "Working with the codebase" lists them). That step
stops two rungs above the rung the chunk's item picks, and the worker's prompts offer it only while
the worker is below that limit. Each finished or unfinished verdict, stop and step-up in the
@@ -79,7 +80,7 @@ it routed on L. A todo.md or an archive that cannot be read or parsed is said on
without it.
The judge of a model listed in JUDGE_REPLAYED (bin/loop_claude/routing.py) runs on the rung the
reviewers' E + I picks for a review from that model: the routed item's, or a higher one taken in.
reviewers' E + I, Route.reviewed_on, picks for a review from that model: the routed item's, or a higher one taken in.
It never runs below the model's cheapest rung, and runs on it when no item routed the chunk or was
taken in. Its rung stays put when the worker steps up. A model is listed once judge-replay found its cheapest rung returning every
verdict the reference judge reproduced. Any other model's judge runs at the effort its settings
@@ -223,7 +224,7 @@ def routed(loop_run: LoopRun, anchor: Rung | None, archived: typing.Callable[[],
def after_verdict(loop_run: LoopRun, anchor: Rung | None, verdict: Finished | Unfinished) -> LoopRun:
if isinstance(verdict, Finished):
return dataclasses.replace(loop_run, route=None, unfinished_evidence="")
route = stepped(anchor, loop_run.route, verdict.bundled, bool(verdict.escalation), verdict.bundled_escape_and_impact) if anchor and loop_run.route else loop_run.route
route = stepped(anchor, loop_run.route, verdict.bundled, bool(verdict.escalation)).taking_in(verdict.bundled_escape_and_impact) if anchor and loop_run.route else loop_run.route
return dataclasses.replace(loop_run, route=route, unfinished_evidence=verdict.evidence)
+3 -4
View File
@@ -61,17 +61,16 @@ def escalation_cap(anchor: Rung, route: Route) -> Rung:
return climbed(item_rung(anchor, route), ESCALATION_CAP)
def stepped(anchor: Rung, route: Route, bundled: int, escalated: bool, bundled_escape_and_impact: int = 0) -> Route:
"""The route after one more unfinished verdict. Its rules, in order: the rung never falls below kept_rung; a bundled item lifts it to the rung that item's L picks; every second unfinished verdict steps it up one rung; so does an escalation the judge found, up to escalation_cap, two rungs above item_rung; and both steps on one verdict make one step. The route keeps the highest E + I bundled so far, never a lower one.
def stepped(anchor: Rung, route: Route, bundled: int, escalated: bool) -> Route:
"""The route after one more unfinished verdict. Its rules, in order: the rung never falls below kept_rung; a bundled item lifts it to the rung that item's L picks; every second unfinished verdict steps it up one rung; so does an escalation the judge found, up to escalation_cap, two rungs above item_rung; and both steps on one verdict make one step.
bundled, escalated and bundled_escape_and_impact are the verdict's fields, not the verdict, since loop_claude.cycle.judge imports this module through prompts.
bundled and escalated are the verdict's fields, not the verdict, since loop_claude.cycle.judge imports this module through prompts.
"""
rung = taken_in(anchor, route, bundled)
unfinished = route.unfinished + 1
counted_out = unfinished >= UNFINISHED_PER_STEP
# The judge found the escalation trigger the worker cited in asking for a higher rung.
escalates = escalated and position(rung) < position(escalation_cap(anchor, route))
route = dataclasses.replace(route, escape_and_impact_taken_in=max(route.escape_and_impact_taken_in, bundled_escape_and_impact))
if counted_out or escalates:
return dataclasses.replace(route, rung=stepped_up(rung), unfinished=0)
return dataclasses.replace(route, rung=rung, unfinished=unfinished)
+13 -9
View File
@@ -624,11 +624,14 @@ class Routing(unittest.TestCase):
self.assertEqual(routing.stepped(self.OPUS, Route(self.XHIGH), 0, True), Route(self.XHIGH, unfinished=1))
self.assertEqual(routing.stepped(self.OPUS, Route(self.SONNET, 3, 2, 4), 4, True), Route(self.HIGH, 3, 2, 4, unfinished=1))
def test_keeps_the_highest_e_plus_i_the_judge_saw_taken_in_and_never_lowers_it(self):
taken = routing.stepped(self.OPUS, Route(self.OPUS, 3, 3, 4), 0, False, 6)
self.assertEqual(taken, Route(self.OPUS, 3, 3, 4, unfinished=1, escape_and_impact_taken_in=6))
self.assertEqual(routing.stepped(self.OPUS, taken, 0, False, 5), Route(self.HIGH, 3, 3, 4, escape_and_impact_taken_in=6))
self.assertEqual(routing.stepped(self.OPUS, Route(self.OPUS), 0, False, 5), Route(self.OPUS, unfinished=1, escape_and_impact_taken_in=5))
def test_keeps_an_e_plus_i_taken_in_only_where_it_lifts_the_reviewers(self):
taken = Route(self.OPUS, 3, 3, 4).taking_in(6)
self.assertEqual(taken, Route(self.OPUS, 3, 3, 4, escape_and_impact_taken_in=6))
self.assertEqual(taken.taking_in(5), taken)
self.assertEqual(Route(self.OPUS, 3, 3, 4).taking_in(4), Route(self.OPUS, 3, 3, 4))
self.assertEqual(Route(self.OPUS, 3, 3, 4).taking_in(3), Route(self.OPUS, 3, 3, 4))
self.assertEqual(Route(self.OPUS).taking_in(5), Route(self.OPUS, escape_and_impact_taken_in=5))
self.assertEqual(Route(self.OPUS).taking_in(0), Route(self.OPUS))
def test_a_rung_an_edit_took_off_the_ladder_counts_as_the_projects(self):
self.assertEqual(routing.stepped(self.OPUS, Route(Rung("claude-opus-5-5", "low")), 0, False).rung, self.OPUS)
@@ -645,7 +648,6 @@ class Routing(unittest.TestCase):
def test_runs_the_judge_on_the_rung_the_highest_e_plus_i_taken_in_picks(self):
self.assertEqual(routing.judge_rung("claude-opus-5-5", Route(self.OPUS, 3, 3, 4, escape_and_impact_taken_in=6)), self.XHIGH)
self.assertEqual(routing.judge_rung("claude-opus-5-5", Route(self.OPUS, 3, 3, 6, escape_and_impact_taken_in=5)), self.XHIGH)
self.assertEqual(routing.judge_rung("claude-opus-5-5", Route(self.OPUS, escape_and_impact_taken_in=5)), self.HIGH)
def test_refuses_a_route_whose_item_has_levels_off_their_scales_or_levels_without_an_item(self):
@@ -654,8 +656,8 @@ class Routing(unittest.TestCase):
with self.assertRaises(ValueError):
Route(self.HIGH, item, likelihood, escape_and_impact)
def test_refuses_a_route_taking_in_an_e_plus_i_off_its_scale(self):
for taken_in in (1, 9, -1):
def test_refuses_a_route_taking_in_an_e_plus_i_off_its_scale_or_not_above_its_items(self):
for taken_in in (1, 9, -1, 5, 4):
with self.subTest(taken_in=taken_in):
with self.assertRaises(ValueError):
Route(self.HIGH, 3, 4, 5, escape_and_impact_taken_in=taken_in)
@@ -681,6 +683,7 @@ class Routing(unittest.TestCase):
self.assertEqual(str(unrouted), "claude-opus-5-5 at high effort, taking in an E + I of 6")
self.assertEqual(route_from(str(unrouted)), unrouted)
self.assertIsNone(route_from("claude-opus-5-5 at high effort, taking in an E + I of 9"))
self.assertIsNone(route_from("claude-opus-5-5 at high effort, routed by item 3's L of 4 and E + I of 5, taking in an E + I of 5"))
def test_reads_no_route_from_a_line_whose_levels_are_off_their_scales_or_an_r_plus_c_route_wrote(self):
for line in ("claude-opus-5-5 at high effort, routed by item 3's L of 5 and E + I of 5", "claude-opus-5-5 at high effort, routed by item 3's L of 0 and E + I of 5", "claude-opus-5-5 at high effort, routed by item 3's L of 4 and E + I of 9", "claude-opus-5-5 at high effort, routed by item 3's L of 4 and E + I of 1", "claude-opus-5-5 at high effort, routed by item 3's R + C of 11"):
@@ -782,6 +785,8 @@ class Steps(unittest.TestCase):
after = main.after_verdict(main.LoopRun(cycle_number=1, root="/r", task="Do it.", unfinished_evidence="", route=before), self.OPUS, Unfinished("working", 0, bundled_escape_and_impact=6))
self.assertIsNone(main.archive_step(archive, opened, after, before, FakeEffects().effects()))
self.assertEqual(main.archived_route(archive, opened), Route(self.OPUS, 3, 3, 4, escape_and_impact_taken_in=6))
lower = main.after_verdict(main.LoopRun(cycle_number=1, root="/r", task="Do it.", unfinished_evidence="", route=before), self.OPUS, Unfinished("working", 0, bundled_escape_and_impact=3))
self.assertEqual(lower.route, Route(self.OPUS, 3, 3, 4, unfinished=1))
class WorkerArgs(unittest.TestCase):
@@ -812,7 +817,6 @@ class WorkerArgs(unittest.TestCase):
def test_launches_reviewers_on_the_rung_the_highest_e_plus_i_taken_in_picks(self):
opus = Rung("claude-opus-5-5", "medium")
self.assertIn(f"loop-claude runs you on claude-opus-5-5 at medium effort. Launch each reviewer with the Agent tool set to model opus, effort max, the rung an E + I of 7 taken into the chunk picks. When an escalation trigger", prompts.resumed("", Route(opus, 3, 3, 5, escape_and_impact_taken_in=7), opus))
self.assertIn(" Launch each reviewer with the Agent tool set to model opus, effort xhigh, the rung item 3's E + I of 6 picks.", prompts.resumed("", Route(opus, 3, 3, 6, escape_and_impact_taken_in=5), opus))
self.assertIn(" Launch each reviewer with the Agent tool set to model opus, effort high, the rung an E + I of 5 taken into the chunk picks.", prompts.resumed("", Route(opus, escape_and_impact_taken_in=5), opus))
def test_keeps_seats_and_the_security_pass_on_the_projects_rung_while_the_worker_runs_above_it(self):