Rename loop-claude to build-release, with no alias

This commit is contained in:
2026-12-03 15:22:11 +01:00
parent 38102d5aa5
commit 969190064e
139 changed files with 717 additions and 671 deletions
+3 -3
View File
@@ -4,15 +4,15 @@ from agent_cycle import escalation_mark
from failure import Failure
from agent_cycle.judge import Grounds, judge_rules, TASK_HEADING, transcript_heading
from claude_code.transcript import human_answers
from chunk_driver.drivers import LOOP_CLAUDE
from chunk_driver.drivers import BUILD_RELEASE
from agent_cycle.worker_prompts import typed_answer
def grounds_of(prompt: str, entries: list[Entry]) -> Grounds | Failure:
"""What the quotes of a judge run on prompt are checked against, as judge_prompt would have made it for the transcript's entries: the premises and the records before the task are quotable, the task is quotable as the evidence, and the transcript the judge was shown comes before the rules. The prompt is split on the headings judge_prompt writes, at the first of each; a Failure where it lacks one. Rules of an earlier wording stay part of the transcript, a slack that lets an evidence quote them pass."""
before_task, task_heading, after_task = prompt.partition(f"\n\n{TASK_HEADING}")
heading = transcript_heading(LOOP_CLAUDE)
heading = transcript_heading(BUILD_RELEASE)
task, found_heading, shown = after_task.partition(heading)
if not (task_heading and found_heading):
return Failure(f"the archived prompt lacks the heading {TASK_HEADING.strip()!r} or {heading.strip()!r}, which judge_prompt writes")
return Grounds(shown.removesuffix(f"\n\n{judge_rules(ANSWER_DESTINATIONS, LOOP_CLAUDE)}"), escalation_mark.after_mark(entries, 0), before_task, tuple(human_answers(entries, typed_answer)), task.removesuffix("\n\n"))
return Grounds(shown.removesuffix(f"\n\n{judge_rules(ANSWER_DESTINATIONS, BUILD_RELEASE)}"), escalation_mark.after_mark(entries, 0), before_task, tuple(human_answers(entries, typed_answer)), task.removesuffix("\n\n"))
+10 -10
View File
@@ -1,17 +1,17 @@
"""Replay loop-claude's judge on archived verdicts, to find the lowest rung that returns them: docs/decisions.md → `routing: on a model judge-replay covered`.
"""Replay build-release's judge on archived verdicts, to find the lowest rung that returns them: docs/decisions.md → `routing: on a model judge-replay covered`.
usage: judge-replay <model> [--offline]
<model> is a project model on the routing ladder this setup ships, such as claude-opus-5-5. The tool replays the
verdicts archived for the projects that ~/.claude/loop-claude-models.json runs on it: the latest
15 of each kind, finished, unfinished, interrupt and quoted answer. Where the archive kept the judge's own
prompt (docs/decisions.md → `loop-claude: the archive keeps the raw transcript and each judge run, …`), the
prompt (docs/decisions.md → `build-release: the archive keeps the raw transcript and each judge run, …`), the
replay hands the judge that prompt, which holds what the judge read then. For a verdict from before the
archive kept it, the replay builds the prompt from the transcript copy beside the verdict, with the task,
premises and records each project holds now.
It first replays every verdict on the reference judge: the model at xhigh effort, the rung the
judge ran on before loop-claude routed it. A verdict the reference judge returns another kind on
judge ran on before build-release routed it. A verdict the reference judge returns another kind on
may rest, where its prompt was rebuilt, on records or judge rules that have changed since; where the archived prompt was
replayed, the judge's own variance is the cause. Either way no rung is held to it. It
then replays the rest on each rung above the model's cheapest that a chunk's E + I raises a
@@ -27,8 +27,8 @@ JUDGE_REPLAYED in bin/agent_cycle/routing.py, which routes that model's judge. j
keeps the judge to its own model's rungs; a rung above them that misses no interrupt is the
evidence to let the judge climb onto it.
It keeps each run and the report it prints in loop-claude's archive, in
replays/judge-replay-<model>-<UTC stamp>/ under ~/.claude/loop-claude-transcripts or $LOOP_CLAUDE_TRANSCRIPTS.
It keeps each run and the report it prints in build-release's archive, in
replays/judge-replay-<model>-<UTC stamp>/ under ~/.claude/loop-claude-transcripts or $BUILD_RELEASE_TRANSCRIPTS.
A run's .jsonl file starts with a line holding claude's arguments, working directory, prompt, exit code and
stderr, then holds claude's stream-json output; result.md holds the report.
@@ -70,7 +70,7 @@ from judge_replay.archived_prompt import grounds_of
from transcript_archive.judge_run import JudgeRun
from model_routing.ladder import Ladder, ProjectRung, REVIEW_STEPS, Rung
from claude_code.reply import Limited
from chunk_driver.drivers import LOOP_CLAUDE
from chunk_driver.drivers import BUILD_RELEASE
from model_routing.ladder_file import read_ladder, SHIPPED
from chunk_driver.project.premises import read_premises
from chunk_driver.project.records import read_records, RECORDS_NAMED
@@ -81,7 +81,7 @@ TOOL = "judge-replay"
USAGE = f"{TOOL} <model> [--offline]; <model> is a model on the routing ladder"
OFFLINE = "--offline"
PER_KIND = 15
# The effort settings.json gave every judge before loop-claude routed it; the archived verdicts came from it.
# The effort settings.json gave every judge before build-release routed it; the archived verdicts came from it.
REFERENCE_EFFORT = "xhigh"
@@ -97,7 +97,7 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
if isinstance(cases, Failure):
return failed(TOOL, cases.reason)
if not cases:
return failed(TOOL, f"no archived verdicts of projects on {project.rung.model} in {archive_root(home, env)}; run loop-claude on a project on that model first")
return failed(TOOL, f"no archived verdicts of projects on {project.rung.model} in {archive_root(home, env)}; run build-release on a project on that model first")
if OFFLINE in argv:
return offline(project.rung.model, cases, archive_root(home, env), effects)
cases = sample(cases, PER_KIND)
@@ -166,7 +166,7 @@ def rule(case: Case, rung: Rung, home: pathlib.Path, effects: Effects) -> Kind |
grounds = grounds_of(kept.prompt, entries)
if isinstance(grounds, Failure):
return verdict_kind(grounds)
verdict: Verdict | Failure | Limited = first_reply(lambda: judge_archived(case.root, kept.prompt, grounds, len(entries), rung, LOOP_CLAUDE, effects))
verdict: Verdict | Failure | Limited = first_reply(lambda: judge_archived(case.root, kept.prompt, grounds, len(entries), rung, BUILD_RELEASE, effects))
return verdict if isinstance(verdict, Limited) else verdict_kind(verdict)
premises, records = read_premises(case.root, home), read_records(case.root, home, home / CLAUDE_HOME)
if isinstance(premises, Failure):
@@ -174,5 +174,5 @@ def rule(case: Case, rung: Rung, home: pathlib.Path, effects: Effects) -> Kind |
if isinstance(records, Failure):
return verdict_kind(records)
# 0 for the route's mark, as before any step-up: the replay compares verdict kinds, and a mark changes only which escalation quotes count.
verdict = first_reply(lambda: judge_once(case.root, Brief(task=case.task, premises=premises, records=records, records_named=RECORDS_NAMED, answer_destinations=ANSWER_DESTINATIONS, entries=entries, escalated_at=0, driver=LOOP_CLAUDE), rung, effects))
verdict = first_reply(lambda: judge_once(case.root, Brief(task=case.task, premises=premises, records=records, records_named=RECORDS_NAMED, answer_destinations=ANSWER_DESTINATIONS, entries=entries, escalated_at=0, driver=BUILD_RELEASE), rung, effects))
return verdict if isinstance(verdict, Limited) else verdict_kind(verdict)
+12 -12
View File
@@ -20,7 +20,7 @@ from failure import Failure
from agent_cycle.verdicts import Finished, Interrupt, QuotedAnswer, Unfinished
from judge_replay.archived_prompt import grounds_of
from agent_cycle.judge import judge_archived, judge_rules, Rejected, TASK_HEADING, transcript_heading
from chunk_driver.drivers import LOOP_CLAUDE
from chunk_driver.drivers import BUILD_RELEASE
from judge_replay import main
from rung_replay.search import Miss, Replay, Tried
from model_routing.ladder import Rung
@@ -256,19 +256,19 @@ class Main(unittest.TestCase):
self.assertIn("replaying 8 verdicts on ", err)
self.assertEqual(set(together.most.values()), {4})
def test_the_prompt_and_the_reply_schema_of_a_rebuilt_run_name_loop_claude_and_the_records_and_show_the_transcript_once(self):
def test_the_prompt_and_the_reply_schema_of_a_rebuilt_run_name_build_release_and_the_records_and_show_the_transcript_once(self):
code, _, err = self.run_main(["claude-opus-5-5"], lambda rung, interrupted: self.verdict(interrupted, f"said {INTERRUPTED if interrupted else FINISHED}"))
self.assertEqual(code, 0, err)
for prompt, schema in zip(self.prompts, self.schemas, strict=True):
self.assertIn("\n\nThe records: the project's working rules and decisions, then the human's rules for every project:\n", prompt)
self.assertIn("what loop-claude told it on [loop] lines, latest last:\n", prompt)
self.assertIn("what build-release told it on [loop] lines, latest last:\n", prompt)
self.assertEqual(prompt.count("said Verdict: "), 1)
self.assertIn("loop-claude", schema)
self.assertIn("build-release", schema)
self.assertNotIn("None", schema)
def test_hands_the_judge_the_prompt_the_archive_kept_and_rebuilds_the_prompt_of_a_verdict_with_none(self):
kept = self.home / ".claude" / "loop-claude-transcripts" / "proj" / "c1"
prompt = "From the goals file, OLD premises\n\nThe records: none\n\nThe task the worker was given:\nDo it.\n\nWhat the worker did and said, what the human typed on [human] lines and what loop-claude told it on [loop] lines, latest last:\nsaid Verdict: finished\n\nOLD rules"
prompt = "From the goals file, OLD premises\n\nThe records: none\n\nThe task the worker was given:\nDo it.\n\nWhat the worker did and said, what the human typed on [human] lines and what build-release told it on [loop] lines, latest last:\nsaid Verdict: finished\n\nOLD rules"
(kept / "judge").mkdir()
(kept / "judge" / "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json").write_text(json.dumps({"prompt": prompt, "reply": {"type": "result"}}))
(kept / "t0.outcomes.md").write_text("Task: Do it.\n\n2026-10-14T10:00:00Z Verdict: finished\n\nJudge: j\nJudge run: judge/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json\nWorker: x\n")
@@ -277,8 +277,8 @@ class Main(unittest.TestCase):
self.assertIn("The reference judge, claude-opus-5-5 at xhigh effort, reproduced 2.", out)
# The first replay, on the finished verdict, reads the archived prompt; the second, on the interrupt, is rebuilt from the records of today.
self.assertEqual(self.prompts[0], prompt)
# The reply's schema names loop-claude to the judge of either prompt.
self.assertEqual([schema for schema in self.schemas if "loop-claude" not in schema or "None" in schema], [])
# The reply's schema names build-release to the judge of either prompt.
self.assertEqual([schema for schema in self.schemas if "build-release" not in schema or "None" in schema], [])
self.assertEqual(self.calls[0][2], self.calls[1][2])
self.assertTrue(self.calls[0][2].endswith("/code/proj"))
self.assertIn("The task the worker was given:\nDo it.", self.prompts[1])
@@ -375,7 +375,7 @@ class Main(unittest.TestCase):
class JudgeArchivedRuns(unittest.TestCase):
"""judge_archived on a prompt as judge_prompt writes it: the premises, the task, the transcript the judge was shown, and the rules."""
PROMPT = f"HEAD: Ship fast.\n\n{TASK_HEADING}Do it.\n\n{transcript_heading(LOOP_CLAUDE)}Worker chose option B.\n[human] Use Postgres.\n\n{judge_rules(ANSWER_DESTINATIONS, LOOP_CLAUDE)}"
PROMPT = f"HEAD: Ship fast.\n\n{TASK_HEADING}Do it.\n\n{transcript_heading(BUILD_RELEASE)}Worker chose option B.\n[human] Use Postgres.\n\n{judge_rules(ANSWER_DESTINATIONS, BUILD_RELEASE)}"
ENTRIES = [AssistantTurn(parts=(Text("Worker chose option B."),)), HumanTurn(text="Use Postgres."), LoopPrompt(text="Keep going.")]
def judged(self, prompt=PROMPT, **fields):
@@ -389,7 +389,7 @@ class JudgeArchivedRuns(unittest.TestCase):
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, forge=unused, git=unused, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, replace_file=unused, sleep=unused, stream_claude=unused, timer=unused, tmux=unused, tmux_on_terminal=unused)
grounds = grounds_of(prompt, self.ENTRIES)
return (grounds if isinstance(grounds, Failure) else judge_archived("/code/p", prompt, grounds, len(self.ENTRIES), REFERENCE, LOOP_CLAUDE, effects)), cwds
return (grounds if isinstance(grounds, Failure) else judge_archived("/code/p", prompt, grounds, len(self.ENTRIES), REFERENCE, BUILD_RELEASE, effects)), cwds
def test_runs_in_the_projects_folder_and_stamps_the_verdict_with_the_entries_read(self):
verdict, cwds = self.judged()
@@ -404,7 +404,7 @@ class JudgeArchivedRuns(unittest.TestCase):
self.assertIsInstance(self.judged(evidence="Do it. ... Use Postgres.")[0], Unfinished)
def test_splits_the_prompt_into_the_premises_the_task_and_the_transcript_at_the_first_heading_of_each(self):
heading = transcript_heading(LOOP_CLAUDE)
heading = transcript_heading(BUILD_RELEASE)
again = self.PROMPT.replace("Worker chose option B.", f"Worker chose option B. {heading}Again.", 1)
for prompt in (self.PROMPT, again):
grounds = grounds_of(prompt, self.ENTRIES)
@@ -420,11 +420,11 @@ class JudgeArchivedRuns(unittest.TestCase):
self.assertEqual((type(rejected), rejected.cost), (Rejected, 0.25))
def test_checks_neither_the_task_nor_the_rules_as_the_transcript_or_the_premises(self):
self.assertIsInstance(self.judged(evidence=judge_rules(ANSWER_DESTINATIONS, LOOP_CLAUDE))[0], Rejected)
self.assertIsInstance(self.judged(evidence=judge_rules(ANSWER_DESTINATIONS, BUILD_RELEASE))[0], Rejected)
self.assertIsInstance(self.judged(answer="Do it.", question="Which?")[0], Interrupt)
def test_splits_the_prompt_at_the_first_transcript_heading(self):
quoting = self.PROMPT.replace("Worker chose", f"Quoted: {transcript_heading(LOOP_CLAUDE)}Worker chose", 1)
quoting = self.PROMPT.replace("Worker chose", f"Quoted: {transcript_heading(BUILD_RELEASE)}Worker chose", 1)
self.assertIsInstance(self.judged(quoting, evidence="Quoted:")[0], Unfinished)
def test_splits_the_prompt_at_the_first_task_heading(self):