Answer principles round 1: 1 🔴, 2 🟡; name the worker's rung on an interrupt and archive its step-up at once, step from the taken-in item, drop every escalation after the first step of a cycle, and state stepped's rules once

This commit is contained in:
2026-10-17 22:10:33 +02:00
parent 1c503e8818
commit 602a5fac16
12 changed files with 86 additions and 54 deletions
+12 -9
View File
@@ -60,27 +60,30 @@ def escalation_cap(anchor: Rung, route: Route) -> Rung:
def stepped(anchor: Rung, route: Route, bundled: int, escalated: bool) -> Route:
"""The route after one more unfinished verdict: taken_in's rung, one rung up on every second unfinished verdict or on an escalation the judge found, and one rung up where both fall on one verdict.
"""The route after one more unfinished verdict. Its rung never falls below taken_in's. It steps up one rung on every second unfinished verdict, or on an escalation the judge found while the rung is below escalation_cap; where both fall on one verdict, it steps once.
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
if unfinished >= UNFINISHED_PER_STEP or (escalated and below_cap(anchor, route, rung)):
return dataclasses.replace(route, rung=stepped_up(rung), unfinished=0)
return stepped_from(route, rung)
return dataclasses.replace(route, rung=rung, unfinished=unfinished)
def stepped_by_interrupt(anchor: Rung, route: Route) -> Route:
"""The route after the judge's interrupt carried an escalation: one rung up from kept_rung, up to escalation_cap. An interrupt is no unfinished verdict, so the count of those restarts only with a step."""
rung = kept_rung(anchor, route)
if below_cap(anchor, route, rung):
return dataclasses.replace(route, rung=stepped_up(rung), unfinished=0)
return route
def stepped_by_interrupt(anchor: Rung, route: Route, bundled: int) -> Route:
"""The route after the judge's interrupt carried an escalation: taken_in's rung, one rung up while that is below escalation_cap. An interrupt is no unfinished verdict, so the count of those restarts only with a step."""
rung = taken_in(anchor, route, bundled)
return stepped_from(route, rung) if below_cap(anchor, route, rung) else dataclasses.replace(route, rung=rung)
def stepped_from(route: Route, rung: Rung) -> Route:
"""The route one rung above rung, with the count of unfinished verdicts restarted."""
return dataclasses.replace(route, rung=stepped_up(rung), unfinished=0)
def below_cap(anchor: Rung, route: Route, rung: Rung) -> bool:
"""Whether an escalation trigger may take the worker one rung up from rung without the human's yes."""
"""Whether an escalation trigger may take the worker one rung up from rung without the human's yes: rung is below escalation_cap, two rungs above item_rung."""
return position(rung) < position(escalation_cap(anchor, route))