Answer architecture round 1: 2 🔴, 13 🟡; test the replay's main and report, share one judge run and the archive format, pin the reference judge, route only replayed models, and say why the judge climbs

This commit is contained in:
2026-10-15 08:39:10 +02:00
parent 069b3814b9
commit 16aba4cd98
18 changed files with 309 additions and 139 deletions
+6 -1
View File
@@ -121,8 +121,13 @@ def verdict_from(output: object) -> Verdict | Failure:
def judge(root: str, task: str, premises: str, records: str, rendered_transcript: str, rung: Rung, effects: Effects) -> Verdict | Stop:
return retried("judge", lambda: judge_once(root, task, premises, records, rendered_transcript, rung, effects), effects)
def judge_once(root: str, task: str, premises: str, records: str, rendered_transcript: str, rung: Rung, effects: Effects) -> Verdict | Failure | Limited:
"""One judge run, as judge retries it; judge-replay replays it."""
prompt, shown = judge_prompt(task, premises, records, rendered_transcript)
return retried("judge", lambda: run_judge(root, judge_args(rung), prompt, shown, f"{premises}\n\n{records}", effects), effects)
return run_judge(root, judge_args(rung), prompt, shown, f"{premises}\n\n{records}", effects)
def judge_args(rung: Rung) -> list[str]:
+3 -2
View File
@@ -9,6 +9,7 @@ from loop_claude.effects import Effects
from failure import Failure
from loop_claude.cycle.judge import Finished, Interrupt, judge, QuotedAnswer, Unfinished
from loop_claude.cycle.interrupt import interrupt
from loop_claude.routing import judge_rung
from transcript_archive import outcomes
from loop_claude.paths import Paths
from loop_claude.cycle import prompts
@@ -23,7 +24,7 @@ from loop_claude.stop import Stop
@dataclasses.dataclass(frozen=True)
class Cycle:
effects: Effects
judge_rung: Rung
judge_model: str
paths: Paths
premises: str
project_archive: pathlib.Path
@@ -103,7 +104,7 @@ def rule(cycle: Cycle, transcript_path: str) -> Ruled | Stop:
entries = read_transcript(transcript_path)
if isinstance(entries, Failure):
return Stop(1, entries.reason)
verdict = judge(cycle.root, cycle.task, cycle.premises, cycle.records, render(entries), cycle.judge_rung, cycle.effects)
verdict = judge(cycle.root, cycle.task, cycle.premises, cycle.records, render(entries), judge_rung(cycle.judge_model, cycle.route), cycle.effects)
return verdict if isinstance(verdict, Stop) else Ruled(verdict)
+5 -5
View File
@@ -47,9 +47,9 @@ todo.md's top item in the next release, skipping an item marked question, picks
counts from the model's cheapest rung, and an R + C of 8 or less picks a rung below it; without
such an item, or with a C missing, the chunk runs on the model's cheapest rung. The worker's first
prompt names the rung and the item, and asks the worker to name each item the chunk takes, with its
R + C. The judge runs on the rung that item's R + C picks from the judge's model, never below that
model's cheapest rung, whatever rung the worker steps to; without such an item, on the cheapest
rung. When the worker's rung is below the model's cheapest, the prompt also has the worker launch each
R + C. On a model judge-replay has replayed, the judge runs on the rung that item's R + C picks from
the judge's model, never below that model's cheapest rung, whatever rung the worker steps to;
without such an item, on the cheapest rung. When the worker's rung is below the model's cheapest, the prompt also has the worker launch each
reviewer, each comprehension seat and the security pass in subagents on the cheapest rung. When it
is above, the prompt has the worker launch only each comprehension seat and the security pass on
the cheapest rung. The prompt after each unfinished verdict
@@ -127,7 +127,7 @@ from loop_claude.loop.reload import decode_handed, exec_if_edited, fingerprint,
from loop_claude.effects import Effects
from failure import Failure
from loop_claude.cycle.judge import Finished, Unfinished
from loop_claude.routing import first_route, judge_rung, kept, routed_item, stepped
from loop_claude.routing import first_route, kept, routed_item, stepped
from loop_claude.project.model_choice import get_or_ask_models
from todo_table import Item
from transcript_archive.read import latest_worker
@@ -179,7 +179,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
loop_run = routed(loop_run, anchor, lambda: archived_route(archive_folder, session), lambda: plan_item(root))
route = loop_run.route or Route(Rung(models.worker))
print(f"\n=== cycle {loop_run.cycle_number}, worker on {route.rung} ===", flush=True)
verdict = run_cycle(Cycle(anchor=anchor, effects=effects, judge_rung=judge_rung(models.judge, route), paths=paths, premises=premises, project_archive=archive_folder, records=records, root=loop_run.root, route=route, session=session, task=loop_run.task, unfinished_evidence=loop_run.unfinished_evidence))
verdict = run_cycle(Cycle(anchor=anchor, effects=effects, judge_model=models.judge, paths=paths, premises=premises, project_archive=archive_folder, records=records, root=loop_run.root, route=route, session=session, task=loop_run.task, unfinished_evidence=loop_run.unfinished_evidence))
if isinstance(verdict, Stop):
return verdict
before, loop_run = loop_run.route, after_verdict(loop_run, anchor, verdict)
+15 -5
View File
@@ -7,6 +7,8 @@ from todo_table import Item, items
from model_routing.route import Route
UNFINISHED_PER_STEP = 2
# The models `judge-replay` found returning every verdict on their cheapest rung: docs/decisions.md → `routing:`.
JUDGE_REPLAYED = ("claude-opus-5-5",)
def routed_item(todo: str) -> Item | Failure | None:
@@ -28,7 +30,12 @@ def first_route(anchor: Rung, item: Item | None) -> Route:
def kept(route: Route, anchor: Rung) -> bool:
"""Whether a chunk keeps route: its rung is on the ladder at or above the rung its item's R + C picks from anchor, the project's rung, or anchor itself when no item routed it."""
return highest(route.rung, picked(anchor, route.risk_and_complexity) if route.item else anchor) == route.rung
return highest(route.rung, item_rung(anchor, route)) == route.rung
def item_rung(anchor: Rung, route: Route) -> Rung:
"""The rung the route's item's R + C picks from anchor, the project's rung, or anchor itself when no item routed it."""
return picked(anchor, route.risk_and_complexity) if route.item else anchor
def stepped(anchor: Rung, route: Route, bundled: int) -> Route:
@@ -42,9 +49,12 @@ def stepped(anchor: Rung, route: Route, bundled: int) -> Route:
def judge_rung(judge_model: str, route: Route) -> Rung:
"""The rung the chunk's item picks from the judge model's cheapest rung, never below that rung, whatever rung the worker stepped to; the model alone, at its settings' effort, off the ladder."""
# judge-replay found every rung below Opus 5.5's cheapest one missing verdicts it returns.
"""The rung the route's item picks from the judge model's cheapest rung, never below that rung, whatever rung the worker stepped to.
A model judge-replay has not replayed runs alone, at its settings' effort, as does one off the ladder.
"""
# The archive records no judge rung: each verdict's worker line names the item and R + C that pick it, and judge-replay holds rungs to its own reference judge.
anchor = project_rung(judge_model)
if anchor is None:
if anchor is None or judge_model not in JUDGE_REPLAYED:
return Rung(judge_model)
return highest(anchor, picked(anchor, route.risk_and_complexity)) if route.item else anchor
return highest(anchor, item_rung(anchor, route))
+2 -1
View File
@@ -175,7 +175,7 @@ class Cycles(unittest.TestCase):
self.archive = project_archive(str(self.home / "code" / "proj"), self.home, {})
def cycle(self, fake, records="", unfinished_evidence=""):
return run.Cycle(anchor=None, effects=fake.effects(), judge_rung=Rung("judge-model"), paths=self.paths, premises="## Goals", project_archive=self.archive, records=records, root=str(self.home), route=Route(Rung("worker-model")), session=self.session, task="Do it.", unfinished_evidence=unfinished_evidence)
return run.Cycle(anchor=None, effects=fake.effects(), judge_model="judge-model", paths=self.paths, premises="## Goals", project_archive=self.archive, records=records, root=str(self.home), route=Route(Rung("worker-model")), session=self.session, task="Do it.", unfinished_evidence=unfinished_evidence)
def archived_outcomes(self):
return sorted(path.read_text() for path in self.archive.glob("*/*.outcomes.md"))
@@ -539,6 +539,7 @@ class Routing(unittest.TestCase):
self.assertEqual(routing.judge_rung("claude-opus-5-5", Route(Rung("claude-haiku-5-5", "xhigh"), 3, 2)), self.OPUS)
self.assertEqual(routing.judge_rung("claude-opus-5-5", Route(self.HIGH)), self.OPUS)
self.assertEqual(routing.judge_rung("judge-model", Route(self.HIGH, 3, 11)), Rung("judge-model"))
self.assertEqual(routing.judge_rung("claude-sonnet-5-5", Route(self.HIGH, 3, 11)), Rung("claude-sonnet-5-5"))
def test_archives_the_route_in_a_line_it_reads_back(self):
route = Route(self.HIGH, 3, 11)